コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $name = $form_state->getValue('machine_name');
     $type = $form_state->getValue('type');
     if ($type === static::NO_CONTEXT_KEY) {
         $this->page->removeParameter($name);
         $label = NULL;
     } else {
         $label = $form_state->getValue('label');
         $this->page->setParameter($name, $type, $label);
     }
     $this->page->save();
     // Set the submission message.
     drupal_set_message($this->t('The %label parameter has been updated.', ['%label' => $label ?: $name]));
     $form_state->setRedirectUrl($this->page->toUrl('edit-form'));
 }