Contao\CoreBundle\DataContainer\PaletteManipulator::applyToString PHP Method

applyToString() public method

Applies the changes to a palette string.
public applyToString ( string $palette, boolean $skipLegends = false ) : string
$palette string
$skipLegends boolean
return string
    public function applyToString($palette, $skipLegends = false)
    {
        $config = $this->explode($palette);
        if (!$skipLegends) {
            foreach ($this->legends as $legend) {
                $this->applyLegend($config, $legend);
            }
        }
        // Make sure there is at least one legend
        if (0 === count($config)) {
            $config = [['fields' => [], 'hide' => false]];
        }
        foreach ($this->fields as $field) {
            $this->applyField($config, $field, $skipLegends);
        }
        return $this->implode($config);
    }