Added shades support in trait
This commit is contained in:
@@ -8,6 +8,8 @@ trait HasColors
|
||||
{
|
||||
private $colors;
|
||||
|
||||
private $enableShades;
|
||||
|
||||
public function setColors($colors)
|
||||
{
|
||||
$this->colors = $colors;
|
||||
@@ -22,9 +24,25 @@ trait HasColors
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function enableShades()
|
||||
{
|
||||
$this->enableShades = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function disableShades()
|
||||
{
|
||||
$this->enableShades = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function initColors()
|
||||
{
|
||||
$this->colors = $this->defaultColors();
|
||||
|
||||
$this->enableShades = true;
|
||||
}
|
||||
|
||||
private function defaultColors()
|
||||
@@ -35,12 +53,15 @@ trait HasColors
|
||||
protected function colorsFromArray($array)
|
||||
{
|
||||
$this->colors = data_get($array, 'colors', $this->defaultColors());
|
||||
|
||||
$this->enableShades = data_get($array, 'enableShades', true);
|
||||
}
|
||||
|
||||
protected function colorsToArray()
|
||||
{
|
||||
return [
|
||||
'colors' => $this->colors,
|
||||
'enableShades' => $this->enableShades,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user