Feature proposal #5947
open
CBLib: Implement layout api
Added by krileon over 8 years ago.
Updated about 6 years ago.
Description
Instead of hardcoding Bootstrap or framework classes create a params array of them mapped to generic names. Example usage with Bootstrap being upgraded from 3 to 4 only needing minor changes.
Bootstrap 3:
Application::Layout()->get( 'box.container' ) // .panel
Application::Layout()->get( 'box.header' ) // .panel-header
Application::Layout()->get( 'box.title' ) // .panel-title
Bootstrap 4:
Application::Layout()->get( 'box.container' ) // .card
Application::Layout()->get( 'box.header' ) // .card-header
Application::Layout()->get( 'box.title' ) // .card-title
This should be done at the same time as Bootstrap 4 upgrade to easy future upgrades. If possible shorten the usage further to something like CBLayout( 'path' ). Shorter the better as this will be used.. a lot.
Files
The layout class should also be able to path to template files. This will avoid duplicating template loader functions used in various plugins. Should also be capable of overriding layouts via Joomla template layout overrides as well.
Right, but this would be a global layout API to be used by any plugin that also handles the CSS framework markup. Joomla has an interesting approach to the markup as follows.
JHtml::_('bootstrap.addTab', 'myTab', 'groups', JText::_('COM_USERS_ASSIGNED_GROUPS', true))
TAB CONTENTS HERE
JHtml::_('bootstrap.endTab')
There is also a new layouts proposal in Joomla that might go into 3.6, 3.7 or 4.0 (the discussion is still open)
After some research I believe the below could provide a lot of usability.
SEE ATTACHED FILE (mod_security keeps rejecting inline)
These are just design ideas however and as I come up with more and do more research will provide them here.
- Target version changed from CB 2.1 to CB 3.0
- Subject changed from Implement layout css library class to CBLib: Implement layout api
Also available in: Atom
PDF