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

Correctly override bundle-configuration #100

Closed zoglo closed 7 months ago

zoglo commented 7 months ago

Description

Explanation of the bug

// Overwrite existing value
if (!$key = array_search($field, array_column($arrClasses, 'key')))
{
    $arrClasses[ $key ] = [
        'key' => $cssClass['key'],
        'value' => $cssClass['value']
    ];
}

image

image

The fix

This is fixed with the following code since it'll actually get they $key based on the $cssClass['key'] now. I also changed it to check for false !== $key rather than !$key for type safety

// Overwrite existing value
if (false !== ($key = array_search($cssClass['key'], array_column($arrClasses, 'key'))))
{
    ...

image

doishub commented 7 months ago

Great, thank you @zoglo!