arodu / cakelte

AdminLTE plugin for CakePHP
https://packagist.org/packages/arodu/cakelte
MIT License
28 stars 6 forks source link

Possible improvement to layout? #35

Closed bgrinter closed 2 years ago

bgrinter commented 2 years ago

Not sure if I'm doing this right. I had added an Icon on the page title e.g.

$this->assign('title', '<i class="nav-icon fas fa-user-cog"></i> Users'); CleanShot 2022-01-21 at 23 55 14

However as this is also used in the page title I see this in the page title

CleanShot 2022-01-21 at 23 56 20@2x

Is this the correct way to do this?

Adding strip_tags to the title should fix this

<title><?= strip_tags($this->fetch('title')) . ' | ' . strip_tags($this->CakeLte->getConfig('app-name')) ?></title> Is it possible to override the default in the plugin with my own? I tries added a copy to src/templates/layout but didn't work.

arodu commented 2 years ago

To overwrite the default layout you have 2 options

  1. adding it in templates/layout, and then in the AppView change the $layout public $layout = 'default';
  2. add a new layout in the path templates/plugin/CakeLte/layout/default.php https://book.cakephp.org/4/en/plugins.html#overriding-plugin-templates-from-inside-your-application

a third option would be, that you make a pull request adding the strip_tags

bgrinter commented 2 years ago

Thanks - I had tried previously in templates layout but didn't work. The second options worked perfect!