You are here

protected function AjaxColorForm::getColorTemperatures in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 form_api_example/src/Form/AjaxColorForm.php \Drupal\form_api_example\Form\AjaxColorForm::getColorTemperatures()

Returns a list of color temperatures.

Return value

array An associative array of color temperatures, suitable to use as form options.

1 call to AjaxColorForm::getColorTemperatures()
AjaxColorForm::buildForm in modules/form_api_example/src/Form/AjaxColorForm.php
Form constructor.

File

modules/form_api_example/src/Form/AjaxColorForm.php, line 114

Class

AjaxColorForm
Implements the ajax demo form controller.

Namespace

Drupal\form_api_example\Form

Code

protected function getColorTemperatures() {
  return array_map(function ($color_data) {
    return $color_data['name'];
  }, $this
    ->getColors());
}