Hi
I want to open discussion on the following
today PWG relies on the picture.tpl to create/manage picture metadata like description, EXIF, tags, comments, etc
problem is that content is hardcoded into template and any extensions to add new tabs from any plugin would constitute parsing of page template content prior to rendering and injecting custom smarty code.
because theme could introduce its own layout and how metadata content is organized, there is no unified way to find place for injection of new content and or format of metadata tab content
I did play around and actually implemented within my theme an event driven model where plugin developers can register their own handlers and then add specially formatted content which in turn would allow theme to build tabs based on this information at the time of the rendering.
Also this method allows to create special PWG admin area where user can show/hide tabs. While I do not have implementation for that specifically, it is easy logical extension
it is not necessarily a model WordPress is using to manage plugins on their end, but it is close
would you be interested in making this approach common and available in the core?
Please note that this approach backward compatibility as it does not preclude plugin developers from using previous "prefilter" method
Last edited by Serge D (2015-03-11 20:50:59)
Offline
Serge D wrote:
Hi
I want to open discussion on the following
hi
always a pleasure to discuss on such thing
Serge D wrote:
problem is that content is hardcoded into template and any extensions to add new tabs from any plugin would constitute parsing of page template content prior to rendering and injecting custom smarty code.
because theme could introduce its own layout and how metadata content is organized, there is no unified way to find place for injection of new content and or format of metadata tab content
the core information of a picture is hardcoded but for metadata that's http://piwigo.org/dev/browser/trunk/the … e.tpl#L310 so such general label/value that any theme can customize
the rest of the message suggest that you want something like the menu with blocks of metadata?
Offline
flop25 wrote:
the core information of a picture is hardcoded but for metadata that's http://piwigo.org/dev/browser/trunk/the … e.tpl#L310 so such general label/value that any theme can customize
theme can customize content of existing tab and use internal variables like $INFO_AUTHOR, $INFO_POSTED_DATE, $rating.USER_RATE, ...
but this is exactly a problem. There is so much stuff around it and format is not unified.
ideally content should be simply some sort of <div> element with content inside.
then format of container could be changed without affecting the content of the tab.
but more importantly, there is no unified boxing model for tabs and navigation between
possible solution is to define each tab as some sort of template with metadata describing ID, Sort Order, placement target (could be used to place tab content in various areas of the theme layout), Title, content in form of some structure and aggregated as collection
then theme takes this collection, enumerates, and construct metadata content layout to match the theme.
3rd party plugin simply adds to collection when new metadata content is published
Also it would be now easier to add extra information to specific tab, because it structure is well defined.
as I said earlier expanding existing collection could be done traversing registered events with trigger_change
flop25 wrote:
the rest of the message suggest that you want something like the menu with blocks of metadata?
yes, this is correct
I call it tabs, because it is easier to visualize, but the same collection could be used in menu, side bars, header and footer of the layout
Offline