Back to ColorField class

Method getSimpleModeLayoutData

protected array
getSimpleModeLayoutData
()
Method to get the data for the simple mode to be passed to the layout for rendering.
Returns
  • array
Since
  • 3.5
Class: ColorField
Project: Joomla

Method getSimpleModeLayoutData - Source code

/**
 * Method to get the data for the simple mode to be passed to the layout for rendering.
 *
 * @return  array
 *
 * @since 3.5
 */
protected function getSimpleModeLayoutData()
{
    $colors = strtolower($this->colors);
    if (empty($colors)) {
        $colors = array('none', '#049cdb', '#46a546', '#9d261d', '#ffc40d', '#f89406', '#c3325f', '#7a43b6', '#ffffff', '#999999', '#555555', '#000000');
    } else {
        $colors = explode(',', $colors);
    }
    if (!$this->split) {
        $count = \count($colors);
        if ($count % 5 == 0) {
            $split = 5;
        } else {
            if ($count % 4 == 0) {
                $split = 4;
            }
        }
    }
    $split = $this->split ?: 3;
    return array('colors' => $colors, 'split' => $split);
}