Feature proposal #5947
openCBLib: Implement layout api
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
Updated by krileon over 8 years ago
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.
Updated by beat over 8 years ago
CBSubs template layouts loader already allows for overrides in Joomla templates. See:
Updated by krileon over 8 years ago
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')
Updated by beat over 8 years ago
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)
Updated by krileon over 8 years ago
- File layout_examples.txt layout_examples.txt added
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.
Updated by krileon about 8 years ago
- Target version changed from CB 2.1 to CB 3.0
Updated by krileon over 6 years ago
Potential PHP Template Libraries:
Twig - https://twig.symfony.com/
Blade - https://laravel.com/docs/5.6/blade
Potential JS Template Libraries:
VueJS - https://vuejs.org/
Updated by krileon over 6 years ago
- Subject changed from Implement layout css library class to CBLib: Implement layout api