function AjaxColorForm::getColorsByTemperature
Same name in other branches
- 3.x modules/form_api_example/src/Form/AjaxColorForm.php \Drupal\form_api_example\Form\AjaxColorForm::getColorsByTemperature()
- 8.x-1.x form_api_example/src/Form/AjaxColorForm.php \Drupal\form_api_example\Form\AjaxColorForm::getColorsByTemperature()
Returns colors that correspond with the given temperature.
Parameters
string $temperature: The color temperature for which to return a list of colors. Can be either 'warm' or 'cool'.
Return value
array An associative array of colors that correspond to the given color temperature, suitable to use as form options.
1 call to AjaxColorForm::getColorsByTemperature()
- AjaxColorForm::buildForm in modules/
form_api_example/ src/ Form/ AjaxColorForm.php - Form constructor.
File
-
modules/
form_api_example/ src/ Form/ AjaxColorForm.php, line 103
Class
- AjaxColorForm
- Implements the ajax demo form controller.
Namespace
Drupal\form_api_example\FormCode
protected function getColorsByTemperature($temperature) {
return $this->getColors()[$temperature]['colors'];
}