public getLegend ( string $name, ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface $palette, ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\LegendInterface $prevLegend = null ) : ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\LegendInterface | ||
$name | string | Name of the legend. |
$palette | ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface | The palette. |
$prevLegend | ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\LegendInterface | The previous legend. |
Результат | ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\LegendInterface |
public function getLegend($name, $palette, $prevLegend = null)
{
if ($name[0] == '+') {
$name = substr($name, 1);
}
if (!$palette->hasLegend($name)) {
$palette->addLegend(new Legend($name), $prevLegend);
}
return $palette->getLegend($name);
}