Skip to content

Commit

Permalink
Merge pull request #18 from oveleon/develop
Browse files Browse the repository at this point in the history
Update from Develop
  • Loading branch information
doishub authored Feb 20, 2020
2 parents 4c46a06 + 55ca3f4 commit bff9937
Show file tree
Hide file tree
Showing 11 changed files with 572 additions and 9 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ This plugin is designed to simplify theme customizations without the need of man
- Many possibilities of use (grids, animations, content properties, ...)
- Clear representation in the backend
- Categories and Groups
- Combine and output as tabs [![new](https://img.shields.io/badge/-new-brightgreen?style=flat-square)](#manage-categories)
- Passing variables to the template [![new](https://img.shields.io/badge/-new-brightgreen?style=flat-square)](#passing-style-group-variables-to-a-template)
- Formatting output using predefined methods or your own [![new](https://img.shields.io/badge/-new-brightgreen?style=flat-square)](#passing-style-group-variables-to-a-template)
- Combine and output as tabs
- Passing variables to the template
- Formatting output using predefined methods or your own
- Import / Export [![new](https://img.shields.io/badge/-new-83aa0e?style=flat-square)](#import--export) [![new](https://img.shields.io/badge/-BETA-F38041?style=flat-square)](#import--export)
- Available for
- Layouts
- Pages
Expand All @@ -24,8 +25,8 @@ This plugin is designed to simplify theme customizations without the need of man
- Content-Elements
- Forms
- Form-Fields
- News [![new](https://img.shields.io/badge/-new-brightgreen?style=flat-square)](#contao-component-style-manager)
- Events [![new](https://img.shields.io/badge/-new-brightgreen?style=flat-square)](#contao-component-style-manager)
- News
- Events
- Third-Party plugin support
- Rocksolid Custom Elements

Expand Down Expand Up @@ -119,6 +120,13 @@ $this->styleManager->prepare('myCategoryIdentifier', ['alias1'])->format("data-s
##### Backend view
![Passing Variables: Image 1](https://www.oveleon.de/share/github-assets/contao-component-style-manager/2.0/template-vars-list.png)

## Import / Export
To fill projects with a default setting, the Import and Export functions are available.

When importing, the categories as well as the CSS groups are only added additively. This allows CSS classes to be added to the actual project without being deleted after an import.

> Please note that the import completes the records by the identifier (categories) and the alias (CSS groups). So if the aliases are changed in the current project, they are not overwritten / added, but a new group is created after the import.
## Support Rocksolid Custom Elements
see: [Rocksolid Custom Elements](https://github.com/madeyourday/contao-rocksolid-custom-elements)

Expand Down
4 changes: 3 additions & 1 deletion src/Resources/contao/classes/StyleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ public static function serializeValues($varValue, $strTable){
}

// Remove unused classes
$arrValue = array_filter($varValue);
$arrValue = array_filter($varValue, function($v){
return $v !== false && !is_null($v) && ($v != '' || $v == '0');
});

// Rebuild array for template variables
while($objStyleGroups->next())
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/contao/classes/Styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function format($format, $method='')
{
foreach ($this->styles[ $this->currIdentifier ] as $alias => $arrVariable)
{
if($value = $this->getGroupValue($arrVariable))
if(($value = $this->getGroupValue($arrVariable)) !== '')
{
$arrValues[ $alias ] = $this->parseValueType($value);
}
Expand All @@ -129,7 +129,7 @@ public function format($format, $method='')
{
foreach ($this->currGroups as $alias)
{
if($value = $this->getGroupValue($this->styles[ $this->currIdentifier ][ $alias ]))
if(($value = $this->getGroupValue($this->styles[ $this->currIdentifier ][ $alias ])) !== '')
{
$arrValues[ $alias ] = $this->parseValueType($value);
}
Expand Down
Loading

0 comments on commit bff9937

Please sign in to comment.