public static Table::valueCallback(&$element, $input, FormStateInterface $form_state)
Determines how user input is mapped to an element's #value property.
Parameters
array $element: An associative array containing the properties of the element.
mixed $input: The incoming input to populate the form element. If this is FALSE, the element's default value should be returned.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
mixed The value to assign to the element.
Overrides FormElement::valueCallback
File
- core/lib/Drupal/Core/Render/Element/Table.php, line 102
Class
- Table
- Provides a render element for a table.
Namespace
Drupal\Core\Render\Element
Code
public static function valueCallback(&$element, $input, FormStateInterface $form_state) { // If #multiple is FALSE, the regular default value of radio buttons is used. if (!empty($element['#tableselect']) && !empty($element['#multiple'])) { // Contrary to #type 'checkboxes', the default value of checkboxes in a // table is built from the array keys (instead of array values) of the // #default_value property. // @todo D8: Remove this inconsistency. if ($input === FALSE) { $element += array('#default_value' => array()); $value = array_keys(array_filter($element['#default_value'])); return array_combine($value, $value); } else { return is_array($input) ? array_combine($input, $input) : array(); } } }
Please login to continue.