oveleon / contao-component-style-manager

This extension is for the Contao CMS and allows you to easily manage and provide custom categories and groups for CSS classes.
MIT License
23 stars 6 forks source link

compatibility with Contao 4.12.4 #55

Closed Fanni-Portier closed 2 years ago

Fanni-Portier commented 2 years ago

Hello!

I tried to use your really promisful extension - but unfortunately I failed.

In the Backend everything seems to work as expected, but I could not manage to get the Class into my fe_page.html5 Template. The compatibility is declared for up to 4.9 but is it possible that it does not work with Contao 4.12.4 or with php 8?

I added this to the template and "testtest" is the category identifier: <?=$this->styleManager->get('testtest')?>

thanks, Fanni

doishub commented 2 years ago

Hello,

there should not be any problems with Contao 4.12 and PHP8. However, I have only tested it with an earlier version than 4.12.4.

Could you post your template once? The integration should look like this:

$this->styleManager->get('testtest');
Fanni-Portier commented 2 years ago

This is the part of the fe_page.html5 with the integration.

`<?php $this->block('main'); ?>

styleManager: styleManager->get('testtest')?>

main ?>
sections('main'); ?>

<?php $this->endblock(); ?>`

It should be working this way? So I have to go error hunting in the backend?

doishub commented 2 years ago

I could imagine that the hook used, where the StyleManager object is added in the templates, does not work for page templates.

Could you please test this once and try to fill the ce_text template or a similar template with your code? If this works, it would confirm my suspicion.

As soon as I have some more time, I will check the problem and see if I can make this feature available for page templates as well.

But yes, this should work:

<h1 class="<?=$this->styleManager->get('testtest')?> ">styleManager: <?=$this->styleManager->get('testtest')?></h1>
doishub commented 2 years ago

I was able to reproduce the issue. In fact, the template variables within pages and layouts are not supported yet.

I will look at the issue again and try to provide an appropriate fix.

doishub commented 2 years ago

Fixed in the develop branch. @Fanni-Portier could you please install this branch and test it? After that, I would create a new release. Thanks!

Fanni-Portier commented 2 years ago

Sorry - I had a few days off :). Thank you very much for your help! I am using the Contao Manager - is there a way to use the develop branch?

zoglo commented 2 years ago

Good evening @Fanni-Portier ,

you should be able to install the develop branch by using dev-develop as a version:

  1. Login and navigate to packages
  2. Click the cog igon next to the package Component StyleManager
  3. enter dev-develop
  4. apply changes and install
Fanni-Portier commented 2 years ago

@zoglo thank you very much - I had no idea! @doishub It workes perfectly fine :)

doishub commented 2 years ago

@Fanni-Portier thanks for testing. Released with 2.6.2.