function ListItemBase::addMoreSubmit

Same name in other branches
  1. 10 core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::addMoreSubmit()

Adds a new option.

Parameters

array $form: The form array to add elements to.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php, line 258

Class

ListItemBase
Plugin base class inherited by the options field types.

Namespace

Drupal\options\Plugin\Field\FieldType

Code

public static function addMoreSubmit(array $form, FormStateInterface $form_state) {
    $form_state->set('items_count', $form_state->get('items_count') + 1);
    $form_state->setRebuild();
}

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