MetaModels\DcGeneral\Events\Table\RenderSetting\Subscriber::buildMetaPaletteConditions PHP Method

buildMetaPaletteConditions() protected method

Apply conditions for meta palettes of the certain render setting types.
protected buildMetaPaletteConditions ( ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface $palette ) : void
$palette ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface The palette.
return void
    protected function buildMetaPaletteConditions($palette)
    {
        foreach ((array) $GLOBALS['TL_DCA']['tl_metamodel_rendersetting']['metapalettes'] as $typeName => $paletteInfo) {
            if ($typeName == 'default') {
                continue;
            }
            if (preg_match('#^(\\w+) extends (\\w+)$#', $typeName, $matches)) {
                $typeName = $matches[1];
            }
            foreach ($paletteInfo as $legendName => $properties) {
                foreach ($properties as $propertyName) {
                    $condition = new PropertyCondition($typeName);
                    $legend = $this->getLegend($legendName, $palette);
                    $property = $this->getProperty($propertyName, $legend);
                    $this->addCondition($property, $condition);
                }
            }
        }
    }