Giter Site home page Giter Site logo

oveleon / contao-component-style-manager Goto Github PK

View Code? Open in Web Editor NEW
23.0 7.0 6.0 367 KB

This extension is for the Contao CMS and allows you to easily manage and provide custom categories and groups for CSS classes.

License: MIT License

PHP 90.93% SCSS 3.56% Twig 5.51%
contao styles css theme contao-bundle

contao-component-style-manager's Introduction

Contao Component StyleManager

maintained license stable unstable downloads

Allows you to easily manage your own CSS classes as groups provided in layouts, pages, articles, modules, news, events, forms, form elements and content elements.

This plugin is designed to simplify theme customizations without the need of manually adding classes or creating new layouts.

Overview

  • Many possibilities of use (e.g. grids, animations, content properties, ...)
  • Clear representation in the backend
  • Categories and Groups
    • Combine and output as tabs
  • Passing variables to the template
    • Formatting output using predefined methods or your own
  • Import / Export
    • Automatic import of configurations from third-party bundles (Bundle configurations) new
    • Partial import new
  • Available for
    • Layouts
    • Pages
    • Articles
    • Modules
    • Content-Elements
    • Forms
    • Form-Fields
    • News
    • Events
    • Third-Party DCA
  • Third-Party plugin support
    • Rocksolid Custom Elements

Example backend view

Install

Installation via Contao Manager

Search for oveleon/contao-component-style-manager in the Contao Manager and add it to your installation. Finally, update the packages.

Manual installation

composer require oveleon/contao-component-style-manager

Documentation

Bugs and feature requests

We appreciate your contributions when opening issues or requesting features. To help keep our issue list tidy, we may need to close issues if questions go unanswered.

Bugs

If you think you have found a bug please follow these guidelines

  1. Search for existing issues and check if your problem has already been reported
  2. Check if you are using the latest version and if the issue has been fixed already
  3. Provide a step-by-step tutorial on how to reproduce the issue in an isolated environment using only this bundle

Feature requests

Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.

Sponsoring

If you find this plugin useful, please consider sponsoring us to help contribute to our time invested and to further development of this and other open source projects. Thank you for your support! - Oveleon.

contao-component-style-manager's People

Contributors

aschempp avatar doishub avatar eki89 avatar fritzmg avatar lupusvii avatar rabauss avatar tastaturberuf avatar zoglo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

contao-component-style-manager's Issues

compatibility with Contao 4.12.4

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:

styleManager->get('testtest')?>

thanks,
Fanni

StyleManager Widget does not keep state on Contao 5.2

Prerequisites

Please select the topic(s) that most closely match your concern

Backend (PHP/CSS)

Description

Before updating to Contao 5.x, the StyleManager Widget would remember the state of an open CSS-group (tab).
This feature is broken in Contao 5.2.

Relevant log output

No response

error in CE using v3.0.0

I installed Style Manager in v3.0.0 on Contao 4.13.13 with PHP 8.1.11 and imported my XML-Asset. When I open a Content Element I got the following error:

TypeError:
Cannot assign null to property Oveleon\ContaoComponentStyleManager\StyleManager\Config::$arrArchive of type array

  at vendor/oveleon/contao-component-style-manager/src/StyleManager/Config.php:138
  at Oveleon\ContaoComponentStyleManager\StyleManager\Config->__construct()
     (vendor/oveleon/contao-component-style-manager/src/StyleManager/Config.php:158)
  at Oveleon\ContaoComponentStyleManager\StyleManager\Config::getInstance()
     (vendor/oveleon/contao-component-style-manager/src/Model/StyleManagerArchiveModel.php:68)
  at Oveleon\ContaoComponentStyleManager\Model\StyleManagerArchiveModel::findAllWithConfiguration(array('order' => 'sorting'))
     (vendor/oveleon/contao-component-style-manager/src/Widget/ComponentStyleSelect.php:53)
  at Oveleon\ContaoComponentStyleManager\Widget\ComponentStyleSelect->generate()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Widget.php:660)
  at Contao\Widget->generateWithError(true)
     (vendor/contao/core-bundle/src/Resources/contao/templates/backend/be_widget.html5:3)
  at include('/htdocs/vendor/contao/core-bundle/src/Resources/contao/templates/backend/be_widget.html5')
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:108)
  at Contao\Widget->inherit()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Widget.php:607)
  at Contao\Widget->parse()
     (vendor/contao/core-bundle/src/Resources/contao/classes/DataContainer.php:795)
  at Contao\DataContainer->row('{type_legend},type,subline,headline;{template_legend:hide},customTpl;{protected_legend:hide},protected;{style_manager_legend},styleManager;{expert_legend:hide},guests,hofff_toc_include,cssID;{invisible_legend:hide},invisible,start,stop;{includeinfo_legend:hide},includeInfo')
     (vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:1973)
  at Contao\DC_Table->edit()
     (vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php:667)
  at Contao\Backend->getBackendModule('article', null)
     (vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php:168)
  at Contao\BackendMain->run()
     (vendor/contao/core-bundle/src/Controller/BackendController.php:49)
  at Contao\CoreBundle\Controller\BackendController->mainAction()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/index.php:44)

Any idea or is there something, I've missed?

Cannot use object of type Oveleon\ContaoComponentStyleManager\Styles as array

I really like your extension, it's great for a customizable frontend. I directly installed the new Version 2.0 today to test the new features.

At first sight everything worked fine, but now, when I want to edit an article containing an element with an image (or showing the same element in the frontend), it gives me the error "Cannot use object of type Oveleon\ContaoComponentStyleManager\Styles as array". The same thing shows up, if I change the content type of an element from text to image and then click "save and close".

Bildschirmfoto 2020-01-10 um 01 42 19
Bildschirmfoto 2020-01-10 um 01 44 20

The respective log file output is
[2020-01-10 00:50:19] request.CRITICAL: Uncaught PHP Exception Error: "Cannot use object of type Oveleon\ContaoComponentStyleManager\Styles as array" at /Users/Raphael/Development/rl-contao-theme-multi/vendor/oveleon/contao-component-style-manager/src/Resources/contao/classes/StyleManager.php line 342 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Cannot use object of type Oveleon\\ContaoComponentStyleManager\\Styles as array at /Users/Raphael/Development/rl-contao-theme-multi/vendor/oveleon/contao-component-style-manager/src/Resources/contao/classes/StyleManager.php:342)"} []

Is there a way you could fix this? I would really like to continue to use your extension.

Contao 4.9.2 kompatibilität

Ich habe das Modul bei einem Projekt mit Contao 4.9.1 im Einsatz. Hier hat alles wunderbar funktioniert.

Nach einem Update auf 4.9.2 werden die Klassen-Einstellungen nicht mehr ans Template übergeben.

Das entfernen einer bestehenden Klasse funktioniert.
Beim Versuch die Klasse wieder auszuwählen und somit erneuten hinzuzufügen scheitert jedoch.

Unbuffered queries in ObjectConversionMigration

Unfortunately, the migration for v3 ends with the following error Cannot execute queries while other unbuffered queries are active in some of my contao instances while running contao-console contao:migrate (with backup!).

Exception trace:
  at /httpdocs/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28
 Doctrine\DBAL\Driver\PDO\Exception::new() at /httpdocs/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:74
 Doctrine\DBAL\Driver\PDO\Connection->query() at /httpdocs/vendor/doctrine/dbal/src/Connection.php:1065
 Doctrine\DBAL\Connection->executeQuery() at /httpdocs/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php:284
 Contao\Database\Statement->query() at /httpdocs/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php:240
 Contao\Database\Statement->execute() at /httpdocs/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php:1174
 Contao\Model::countBy() at /httpdocs/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php:1184
 Contao\Model::countAll() at /httpdocs/vendor/oveleon/contao-component-style-manager/src/StyleManager/Sync.php:43
 Oveleon\ContaoComponentStyleManager\StyleManager\Sync->shouldRunObjectConversion() at /httpdocs/vendor/oveleon/contao-component-style-manager/src/Migration/Version30/ObjectConversionMigration.php:48
 Oveleon\ContaoComponentStyleManager\Migration\Version30\ObjectConversionMigration->shouldRun() at /httpdocs/vendor/contao/core-bundle/src/Migration/MigrationCollection.php:47
 Contao\CoreBundle\Migration\MigrationCollection->getPending() at /httpdocs/vendor/contao/core-bundle/src/Migration/MigrationCollection.php:58
 Contao\CoreBundle\Migration\MigrationCollection->getPendingNames() at /httpdocs/vendor/contao/core-bundle/src/Command/MigrateCommand.php:257
 Contao\CoreBundle\Command\MigrateCommand->executeMigrations() at /httpdocs/vendor/contao/core-bundle/src/Command/MigrateCommand.php:208
 Contao\CoreBundle\Command\MigrateCommand->executeCommand() at /httpdocs/vendor/contao/core-bundle/src/Command/MigrateCommand.php:109
 Contao\CoreBundle\Command\MigrateCommand->execute() at /httpdocs/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /httpdocs/vendor/symfony/console/Application.php:1058
 Symfony\Component\Console\Application->doRunCommand() at /httpdocs/vendor/symfony/framework-bundle/Console/Application.php:96
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /httpdocs/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /httpdocs/vendor/symfony/framework-bundle/Console/Application.php:82
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /httpdocs/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /httpdocs/vendor/contao/manager-bundle/bin/contao-console:38
 include() at /httpdocs/vendor/bin/contao-console:120

this trace leads me to this line:

$archives = StyleManagerArchiveModel::countAll();

this count line should get refactored - but I'm not sure how 😞
Maybe @fritzmg can help?

seems to be related to :
https://contao.slack.com/archives/CK4J0KNDB/p1664471331144309
https://contao.slack.com/archives/CK4J0KNDB/p1665012397236239

Klassenauswahl Einträge doppelt / unvollständig

In einer frischen Contao 4.13 Installation mit Thememanager 1.5.2 und StyleManager Version 3.0.2 werden die Klassen in der Auswahl mehrfach bzw. unvollständig angezeigt.

Habe die style-manager-core.xml Bundle-Konfigurationen importiert, was eigentlich gar nicht notwendig ist.

Add base class per category

It would be helpful if there is in each category the possibility to add one or more base classes, which will be added at the beginning in any case when selecting a CSS group.

Illegal string offset 'id'

Since the last Update (from 2.0.1 to the current) I get a warning for some articles (frontend and backend), when I try to edit the article settings. Somehow not all articles are affected.

Bildschirmfoto 2020-01-25 um 15 20 01

Is there a way to fix this? Any help is appreciated!

Language changes

Hey, i have tested your extension. I like :)

Maybe you can change the words in your manager:
key -> class
and
value -> class title, class name or something like that.

I think it is a bit confusing.

Bildschirmfoto 2019-11-27 um 09 26 24

Config does not work if cssId field is hidden

If a user does not have access to the cssID field in permissions but only the style manager, the configuration does not fully work. It seems a user can add a class, but when removing it it remains in the cssID field.

Unable to create <optgroup> with current code

Hello,

I am unable to create selects with optgroup. And I think it's impossible to, according to the ComponentStyleSelect widget's current code.
I managed to make it work with those slight modifications (starting line 140) :

foreach ($opts as $opt) {
    $arrFieldOption = array(
        'label' => $opt['value'] ?: $opt['key'],
        'value' => $opt['key']
    );
    // if 'value' is an array, we format the subvalues the same way
    if(is_array($arrFieldOption['value'])){
        foreach($arrFieldOption['value'] as $arrFieldSuvOption){
            $arrFieldOption['value'][] = array(
                'label' => $arrFieldSuvOption['value'] ?: $arrFieldSuvOption['key'],
                'value' => $arrFieldSuvOption['key']
            );
        }
    }
    $arrFieldOptions[] = $arrFieldOption;
}

// set options
$strFieldId   = $this->strId . '_' . $objStyleGroups->id;
$strFieldName = $this->strName . '[' . $objStyleGroups->id . ']';

foreach ($arrFieldOptions as $strKey=>$arrOption)
{
    if (!is_array($arrOption['value'])) // if not an array, we want to create a single <option>. Otherwise, it's an <optgroup>
    {
        // nothing changed here, keep original code
    }
    else
    {
        $arrOptgroups = array();

        foreach ($arrOption['value'] as $arrOptgroup)
        {
            $arrOptgroups[] = sprintf('<option value="%s"%s>%s</option>',
                StringUtil::specialchars($arrOptgroup['value']),

                // @deprecated: to be removed in Version 3.0. (interception of storage based on the alias. In future, only the ID must be set)
                static::optionSelected($arrOptgroup['value'], $this->varValue[ $objStyleGroups->id ] ?? '') ?: static::optionSelected($arrOptgroup['value'], $this->varValue[ $objStyleGroups->alias ] ?? ''),

                $arrOptgroup['label']);
        }

        $arrOptions[] = sprintf('<optgroup label="&nbsp;%s">%s</optgroup>', StringUtil::specialchars($arrOption['label']), implode('', $arrOptgroups));
    }
}

This code has been manually tested on my simple case, I don't know if it is "robust" enough to handle other cases.

Problem updating database after uninstalling extension

Contao 4.13.32
Contao Stylemanager 3.4.1
PHP 8.2.12
MariaDB 10.5.21
Hoster:Hostingwerk
Nach der Deinstallation der Erweiterung lassen sich einige Felder nicht aktualisieren.
Hier die Konsolenausgabe:

ALTER TABLE tl_article CHANGE cssID cssID VARCHAR(255) DEFAULT '' NOT NULL
ALTER TABLE tl_content CHANGE cssID cssID VARCHAR(255) DEFAULT '' NOT NULL
ALTER TABLE tl_layout CHANGE cssClass cssClass VARCHAR(255) DEFAULT '' NOT NULL
ALTER TABLE tl_module CHANGE cssID cssID VARCHAR(255) DEFAULT '' NOT NULL
ALTER TABLE tl_page CHANGE cssClass cssClass VARCHAR(64) DEFAULT '' NOT NULL

Bootstrap template

Would you be able to supply a importable Template for bootstrap on installation?

Controller / Route Problem

Prerequisites

Please select the topic(s) that most closely match your concern

Backend (PHP/CSS)

Description

Contao: 5.2.7
PHP 8.1.25
oveleon/contao-component-style-manager: 3.4.2

--

After composer update from Contao 5.2.6 to 5.2.7 (and all the symfony upgrades to v6.4.0) your bundle is throwing following error on cache clear.
Can you help me with this?

Relevant log output

In FileLoader.php line 182:
  Route alias "Oveleon\ContaoComponentStyleManager\Controller\BackendModule\I  
  mportController" can not reference itself in vendor/oveleon/contao-component-style-manager/src/Controller (which is be  
  ing imported from "/vendor/oveleon/contao-co  
  mponent-style-manager/src/ContaoManager/../Resources/config/routes.yaml").   
  Make sure there is a loader supporting the "annotation" type.  
In RouteCollection.php line 375:
  Route alias "Oveleon\ContaoComponentStyleManager\Controller\BackendModule\I  
  mportController" can not reference itself.     

Description for style group

It would be nice to have a description field for each style group, to describe the functionality of the group. Should not be that much expenditure, or am I wrong?

Multi domain / multi theme usage

I use your extension the first time and it looks very promising. Seems like I found a worthy successor of stylepicker4ward. One thing I miss in a multi domain setup is that styles can be limited for different themes and only applied if the page uses a layout of the theme (I know in news etc you don't have the relation).

In my point of view, the style should belong to a theme and should be import and export able using the Contao theme support. Wdyt?

Migration message keeps appearing

After installation, the message "StyleManager configurations were successfully converted. Please note, if custom tables have been added to the StyleManager, they must be migrated using the contao:stylemanager:object-conversion table command." keeps appearing in the Contao Manager or the Install tool. No custom tables used.

Standardscope in Kategorien einstellen

Hey,
mir ist eine Sache aufgefallen - evtl. ist das ja ein Feature wert :-)
ich arbeite sehr viel mit eigenen Inhaltselementen und da ist es immer recht mühsam hinterher in jeder CSS-Gruppe das neue Inhaltselement neu auszuwählen.
Eventuell gibt es ja die Chance, dass man bei den Kategorien bereits die Elemente auswählen kann und das dann automatisch auf die Unterelemente angewandt wird.

Danke, ansonsten super Erweiterung :-)

Contao 4.13 RC2 and Stylemanager

Bei Test einer Installation mit Contao 4.13 RC2 mit dem Style-Manager ist mir aufgefallen, dass sich folgende Tabelle im Installtool nicht ändern lässt:

ALTER TABLE tl_style_manager CHANGE alias alias VARCHAR(255) DEFAULT '' NOT NULL COLLATE 'utf8_bin'

Ist das ein Problem in meinen Einstellungen oder tatsächlich ein Problem der Erweiterung?
Im Backend und im Frontend konnte ich auf den ersten Blick keinerlei Fehler feststellen.
Im Debug-Modus gibt es auch keine Fehler.

Contao 4.13 RC2
XAMPP mit PHP 7.4.27
Windows 10

Doppelte oder falsche Einträge nach Import

Prerequisites

Please select the topic(s) that most closely match your concern

Template (HTML/Twig)

Description

Ich habe gerade ein Contao LTS 5.3.7 installiert mit ThemeManager und Komponenten StyleManager

Habe dann in den StyleManager alles importiert.

Wenn ich nun den Manager nutzen möchte sehe ich Einträge doppelt und manche gar nicht. Denke aber das hinter einen der doppelten Einträge der nicht zu sehene Eintrag ist.

Einmal ein paar Screenshots vom StyleManager Admin und vom Layout Bereich wo man diesen nutzt.

ThemeManager--1--2024-05-04-
ThemeManager--2--2024-05-04-
ThemeManager--3--2024-05-04-
ThemeManager--4--2024-05-04-

Relevant log output

Hier habe ich keinen Output

Attempt to assign property "styleManager" on null

Hi. First thx for your cool extension.

Since the update 2.6.2 i get the following error in the frontend.

Error:
Attempt to assign property "styleManager" on null

  at vendor/oveleon/contao-component-style-manager/src/Resources/contao/classes/StyleManager.php:393
  at Oveleon\ContaoComponentStyleManager\StyleManager->onGeneratePage(object(PageModel), object(LayoutModel), object(PageRegular))
     (vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:191)
  at Contao\PageRegular->prepare(object(PageModel))
     (vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:48)
  at Contao\PageRegular->getResponse(object(PageModel), true)
     (vendor/contao/core-bundle/src/Resources/contao/controllers/FrontendIndex.php:337)
  at Contao\FrontendIndex->renderPage(object(PageModel))
     (vendor/symfony/http-kernel/HttpKernel.php:158)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:80)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web/index.php:31)

If i downgrade to 2.6.1, everything works fine.
I´m running contao 4.9.24 with php 8.0

Default value for CSS class

It would be nice to have the possibility to set a default value for a specific group. For example "gridColumns - Columns" -> Default value 12 Columns...

Error opening content element

I have the version 3.2 installed in a Contao 4.13.16. When I click on a content element to edit it, I get the following message:

[2023-03-23T12:14:11.694056+01:00] request.INFO: Matched route "contao_backend". {"route":"contao_backend","route_parameters":{"_route":"contao_backend","_scope":"backend","_token_check":true,"_controller":"Contao\\CoreBundle\\Controller\\BackendController::mainAction"},"request_uri":"https://www.edukativa.eu/contao?act=edit&do=article&id=14&ref=dr5T2Czz&rt=048c3fc36d2ded5dbe83a8dbeef7e.PJLr2Al6GOLjPS61WaM6ybSWDZe-eoJr8reLcRHq9hQ.UfCT7WE2TKGtambZGOd4mef6SdLNLcAllY7hCyTesGNI3aCeRTB3hoZeWQ&table=tl_content","method":"GET"} [] [2023-03-23T12:14:11.853586+01:00] request.CRITICAL: Uncaught PHP Exception TypeError: "Cannot access offset of type string on string" at /homepages/8/d618066693/htdocs/contao_live/vendor/oveleon/contao-component-style-manager/src/StyleManager/StyleManager.php line 241 {"exception":"[object] (TypeError(code: 0): Cannot access offset of type string on string at /homepages/8/d618066693/htdocs/contao_live/vendor/oveleon/contao-component-style-manager/src/StyleManager/StyleManager.php:241)"} []

Any Ideas how to resolve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.