コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     $configuration = $this->condition->getConfiguration();
     // If this access condition is new, add it to the page.
     if (!isset($configuration['uuid'])) {
         $this->page->addAccessCondition($configuration);
     }
     // Save the page entity.
     $this->page->save();
     $form_state->setRedirectUrl($this->page->toUrl('edit-form'));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $selection = $form_state->getValue('selection');
     $entity_type = $form_state->getValue('entity_type');
     $entity = $this->getEntityFromSelection($entity_type, $selection);
     $this->staticContext = ['label' => $form_state->getValue('label'), 'type' => 'entity:' . $entity_type, 'value' => $entity->uuid()];
     $this->page->setStaticContext($form_state->getValue('machine_name'), $this->staticContext);
     $this->page->save();
     // Set the submission message.
     drupal_set_message($this->submitMessageText());
     $form_state->setRedirectUrl($this->page->toUrl('edit-form'));
 }
コード例 #3
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'));
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function getCancelUrl()
 {
     return $this->page->toUrl('edit-form');
 }