You are here

public function SwitchPageThemeSettingForm::addOne in Switch Page Theme 8

Same name and namespace in other branches
  1. 8.3 src/Form/SwitchPageThemeSettingForm.php \Drupal\switch_page_theme\Form\SwitchPageThemeSettingForm::addOne()
  2. 8.2 src/Form/SwitchPageThemeSettingForm.php \Drupal\switch_page_theme\Form\SwitchPageThemeSettingForm::addOne()

Submit handler for the "Add one more" button.

Add a blank element in table and causes a rebuild.

File

src/Form/SwitchPageThemeSettingForm.php, line 340

Class

SwitchPageThemeSettingForm
Configuration page for Switch page theme settings.

Namespace

Drupal\switch_page_theme\Form

Code

public function addOne(array &$form, FormStateInterface $form_state) {
  $spt_table = $form_state
    ->get('spt_table');
  array_push($spt_table, "");
  $form_state
    ->set('spt_table', $spt_table);
  $form_state
    ->setRebuild();
}