Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forum icons supporting FontAwesome #3733

Closed
Moc opened this issue Mar 19, 2019 · 5 comments
Closed

Forum icons supporting FontAwesome #3733

Moc opened this issue Mar 19, 2019 · 5 comments
Assignees
Labels
plugin: forum type: enhancement An improvement or new feature request

Comments

@Moc
Copy link
Member

Moc commented Mar 19, 2019

Forum icons currently allow uploading of images but apparently no support yet for fontawesome icons (or glyph).. Could this be added?

@Moc Moc added type: enhancement An improvement or new feature request plugin: forum Help Wanted labels Mar 19, 2019
@Moc Moc changed the title Forum icons supporting FontAwesome / Glyphs Forum icons supporting FontAwesome Mar 19, 2019
@CaMer0n
Copy link
Member

CaMer0n commented Apr 3, 2019

It's labelled as an icon, but it is actually an image:

'forum_image'   =>   array ( 'title' => LAN_ICON, 'type' => 'image', 'batch'=>false, 'inline'=>false, 'noedit'=>false, 'data' => 'str', 'width' => 'auto', 'help' => 'Will be displayed next to the forum name', 'readParms' => '', 'writeParms' => 'media=forum&max=1', 'class' => 'center', 'thclass' => 'center',  ),

Changing type from 'image' to 'icon' would no doubt make some people unhappy.
We'd need to add another field with type=icon. (and modify the upgrade routines accordingly)

@Moc
Copy link
Member Author

Moc commented Jun 4, 2019

@CaMer0n I've done some testing on it and I think we can add this feature without having to add another field and without needing to modify the update routines.

  • If I change 'writeParms' => 'media=forum&max=1', to 'writeParms' => 'media=forum&max=1&glyph=1', the Glyph tab shows up and selecting the glyph icon works fine.
  • It saves in the database as (for example) glyphicon-book .glyph
  • For a test, I've modified the forum shortcode to include this:
// Check if it's glyph / icon instead of image 
if (strpos($this->var['forum_image'], '.glyph') !== false) 
{
    return e107::getParser()->toIcon($this->var['forum_image'], $parms);
}
  • This renders correctly as <span class='glyphicon glyphicon-book'><!-- --></span>

  • Forums that use images as icons, still render fine as well

My issue is that I want to use FontAwesome rather than Glyphicons (especially since Bootstrap no longer includes them as of BS4)

Ideally, I'd like to have a FontAwesome tab in the media manager modal (admin area) but I realise this may be quite some work. In the glyphTab() method however, I already do see some preparations for FontAwesome (next issue is FA4 vs FA5...).

What are your thoughts on this? I could try and give creating a new method FaTab() a go if you like....

@CaMer0n
Copy link
Member

CaMer0n commented Jun 4, 2019

@Moc Great! That's even better. glyph=1 should work for FontAwesome too.
Also, toIcon() should automatically detect the .glyph extension.
Or, you could use toGlyph() if you already know it's a .glyph.

Re: FontAwesome in MediaManager..
Is it possible you need to scroll a few more pages before you see them? (note, I'm on slide 4 here)

image

@Moc
Copy link
Member Author

Moc commented Jun 6, 2019

@CaMer0n I'm going to do a facepalm on the mediamanager FA icons..... I am not sure how I missed that haha, thank you!

I'll work on the needed edits as discussed above :)

@Moc Moc self-assigned this Jun 6, 2019
@Moc Moc removed the Help Wanted label Jun 6, 2019
Moc added a commit that referenced this issue Jun 6, 2019
- Renamed forum image to  "Image" (LAN_IMAGE instead of LAN_ICON)
- Added new field forum_icon (LAN_ICON)
- Icon can be used / rendered using {FORUMICON} shortcode in template
- database update requires
- v1 to v2 update needs testing (will do shortly)
@Moc
Copy link
Member Author

Moc commented Jun 6, 2019

After toying around with this and after having discussed this with Cameron, we decided to go for adding a new field, rather than to (ab)use the forum image field for this. It would require many tweaks which in fact is adding a mess and is also a reinvention of the wheel (since the Admin UI already provides for an 'icon' type).

See latest changes. Closing the issue, but let me know if there are any issues arising from this change.

@Moc Moc closed this as completed Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: forum type: enhancement An improvement or new feature request
Projects
None yet
Development

No branches or pull requests

2 participants