function ListIntegerItem::storageSettingsForm

Same name and namespace in other branches
  1. 10 core/modules/options/src/Plugin/Field/FieldType/ListIntegerItem.php \Drupal\options\Plugin\Field\FieldType\ListIntegerItem::storageSettingsForm()

Overrides ListItemBase::storageSettingsForm

File

core/modules/options/src/Plugin/Field/FieldType/ListIntegerItem.php, line 85

Class

ListIntegerItem
Plugin implementation of the 'list_integer' field type.

Namespace

Drupal\options\Plugin\Field\FieldType

Code

public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) {
    $element = parent::storageSettingsForm($form, $form_state, $has_data);
    foreach (Element::children($element['allowed_values']['table']) as $delta => $row) {
        // @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
        // @see \Drupal\Core\Field\Plugin\Field\FieldWidget\NumberWidget::formElement()
        $element['allowed_values']['table'][$delta]['item']['key']['#type'] = 'number';
    }
    return $element;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.