/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.5
*/
protected function getLayoutData()
{
$lang = Factory::getApplication()->getLanguage();
$data = parent::getLayoutData();
$color = strtolower($this->value);
$color = !$color && $color !== '0' ? '' : $color;
// Position of the panel can be: right (default), left, top or bottom (default RTL is left)
$position = ' data-position="' . ($lang->isRtl() && $this->position === 'default' ? 'left' : $this->position) . '"';
if ($color === '' || \in_array($color, array('none', 'transparent'))) {
$color = 'none';
} elseif ($color[0] !== '#' && $this->format === 'hex') {
$color = '#' . $color;
}
switch ($this->control) {
case 'simple':
$controlModeData = $this->getSimpleModeLayoutData();
break;
case 'slider':
$controlModeData = $this->getSliderModeLayoutData();
break;
case 'advanced':
default:
$controlModeData = $this->getAdvancedModeLayoutData($lang);
break;
}
$extraData = array('color' => $color, 'format' => $this->format, 'keywords' => $this->keywords, 'position' => $position, 'validate' => $this->validate);
return array_merge($data, $extraData, $controlModeData);
}