Presenter Output
This section will show you how to use the decorated value provided by the \Anomaly\ColorpickerFieldType\ColorpickerFieldTypePresenter
class.
ColorpickerFieldTypePresenter::code()
The code
method returns the code portion of the hex value.
Returns: string
Example
$decorated->example->code();
Twig
{{ decorated.example.code() }}
ColorpickerFieldTypePresenter::hex()
The hex
method returns the value has a hex code.
Returns: string
Example
$decorated->example->hex();
Twig
{{ decorated.example.hex() }}
ColorpickerFieldTypePresenter::rgb()
The rgb
method returns the value as an RGB definition.
Returns: string
Example
$decorated->example->rgb();
Twig
{{ decorated.example.rgb() }}
ColorpickerFieldTypePresenter::levels()
The levels
method returns an array of red
, blue
, and green
levels. An optional opacity
level is returned if the configured format is rgba
.
Returns: array
Example
$decorated->example->levels()['red'];
Twig
{{ decorated.example.levels().red }}
ColorpickerFieldTypePresenter::red()
The red
method returns the level of red in the value.
Returns: integer
Example
$decorated->example->red();
Twig
{{ decorated.example.red() }}
ColorpickerFieldTypePresenter::blue()
The blue
method returns the level of blue in the value.
Example
$decorated->example->blue();
Twig
{{ decorated.example.blue() }}
ColorpickerFieldTypePresenter::green()
The green
method returns the level of green in the value.
Returns: integer
Example
$decorated->example->green();
Twig
{{ decorated.example.green() }}