Is it possible to add to media manager a specific plugin categories?
For instance, myplugin_icons, myplugin_images?
If so, how can it be donne?
Even now, via the admin ui we can't add more categories to media manager....
Yes, in your plugin.xml file > add the followingh
<mediaCategories>
<category type="image" sef="myplugin_icons" perm="everyone" image='{e_PLUGIN}myplugin/images/image_icon.png'>Myplugin Icons</category>
<category type="image" sef="myplugin_images" perm="everyone" image='{e_PLUGIN}myplugin/images/image.png'>Myplugin Images</category>
</mediaCategories>
An example can be found here: https://github.com/LaocheXe/Unit-eXeSystem/blob/master/unitexe/plugin.xml
Thanks.
But, err, might be a dumb question, but why categories descriptions have images associated with?
I don't remember see images for categories descriptions....
well I copy that from one of the already made plugins, check some other plugins.xml
why categories descriptions have images associated with
They may not be used in the main areas now, but perhaps for future options :)
@rica-carv Gallery uses Media-Category Images and SEF Urls. ;-)
@LaocheXe Somehow, this is not working for me. Latest github files, and trying to create media categories in plugin.xml:
<mediaCategories>
<category type="image" sef="links-page-icons" perm="everyone">Links Page Icons</category>
<category type="image" sef="links-page-images" perm="everyone">Links Page Images</category>
</mediaCategories>
Got only one media category under media manager:
links_page links_page_image Links Page Icons links-page-icons Everyone (public)
Anybody can please tell me why only one category is registered?
@rica-carv Please update from Github and try to install (or use the "plugin repair" button) again.
@CaMer0n Now it seems to work, but with this lines inside plugin.xml:
<category type="image" sef="links-page-icons" perm="everyone" image='{e_PLUGIN}links_page/images/linkspage_icons.png'>Links Page Icons</category>
<category type="image" sef="links-page-images" perm="everyone" image='{e_PLUGIN}links_page/images/linkspage_images.png'>Links Page Images</category>
i got this message after plugin sucessfully installed:
Settings successfully saved.
Adding Link: Links with url [links_page/links] and perm everyone
Adding Media Category: links_page_image
Adding Media Category: links_page_image_2
Anyway, under media manager i got the two correct categories: Links Page Icons & Links Page Images....
Strage is how @LaocheXe got those two same lines as me on his plugin and got no category error as i did.....
Furthermore, it seems that those "system generated" media category names ( links_page_image & links_page_image_2 ) are needed for the modal image picker:
image.php?mode=main&action=dialog&for=_icon&tagid=link-category-icon&iframe=1
(On the current modal string, it only displays _icon category images, so i think that's where i should put the generated categories names, after the for=, right?)
@rica-carv Correct. Use writeParms('media'=>'links_page_image'); etc.
@CaMer0n Is there anyway we can choose in the plugin.xml file the media category name that will be added when plugin is setup?
It seems that right now it's a name choosen by the system, and it's kind of ankwards, since a plugin developer will never knows which name will be choosen in each e107, to specify it at the admin.php file inside the plugin...
It's to avoid conflicts. The developer can calculate it. It's the plugindir + _type + (+ _x if more than one of this type)
numbers correspond with the order in the plugin.xml
@CaMer0n Well, it seems the writeParms is not fun of me....
I've got right the line in admin_config.php as this:
'link_category_icon' => array ( 'title' => LCLAN_CAT_22, 'type' => 'icon', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => array('media'=>'links_page_image'), 'class' => 'left', 'thclass' => 'left', ),
But the modal popup media box just keeps showing me icons, and none whitin the links_page_image category....
What i'm doing wrong?
@rica-carv Make sure to keep clearing the caches (e107 and browser)
@Moc I'm on localhost, with caches disabled. Anyway i cleaned both, issue still persists....
@CaMer0n Is there a list of types that can be used, besides images?
Just a few more two cents on this issue.
When using image as type, this works:
'link_category_icon' => array ( 'title' => LCLAN_CAT_22, 'type' => 'image', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => 'media=featurebox', 'class' => 'left', 'thclass' => 'left', ),
But when using icon as type, it doesn't!
'link_category_icon' => array ( 'title' => LCLAN_CAT_22, 'type' => 'icon', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => 'media=featurebox', 'class' => 'left', 'thclass' => 'left', ),
Furthermore, when using this:
'link_category_icon' => array ( 'title' => LCLAN_CAT_22, 'type' => 'image', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => 'media=links_page_image', 'class' => 'left', 'thclass' => 'left', ),
the generated tag at the admin ui is this:
http://localhost/site/e107_admin/image.php?mode=main&action=dialog&for=links_page_image_image&tagid=link-category-icon&iframe=1
Note the links_page_image_image generated....
This will be an issue when filtering for this:
Adding Media Category: links_page_image_2
Custom MediaCategories only supports images and files, not icons. If you want to use it you'll have to set the type to 'image' .
@CaMer0n I've got another workaround, when still using icon as type: Just add images in media manager to icons_xx category, et voil谩....
It's kind of "stupid", but since media manager allows a image to have multiple categories, it kind of works...
On a side note, why does the icon type can't be allowed as custom media category type? Legacy?
P.S.: Just remembering the links_page_image_image "bug"...
@rica-carv Is still issue still relevant?