Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function actions(array $form, FormStateInterface $form_state)
 {
     $actions = parent::actions($form, $form_state);
     $actions['submit']['#value'] = $this->entity->book['original_bid'] ? $this->t('Update book outline') : $this->t('Add to book outline');
     $actions['delete']['#value'] = $this->t('Remove from book outline');
     $actions['delete']['#access'] = $this->bookManager->checkNodeIsRemovable($this->entity);
     return $actions;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     if ($this->bookManager->checkNodeIsRemovable($this->node)) {
         $this->bookManager->deleteFromBook($this->node->id());
         drupal_set_message($this->t('The post has been removed from the book.'));
     }
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     if ($this->bookManager->checkNodeIsRemovable($this->node)) {
         $this->bookManager->deleteFromBook($this->node->id());
         drupal_set_message($this->t('The post has been removed from the book.'));
     }
     $form_state['redirect_route'] = $this->getCancelRoute();
 }
 /**
  * Checks access for removing the node from its book.
  *
  * @param \Drupal\node\NodeInterface $node
  *   The node requested to be removed from its book.
  *
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
 public function access(NodeInterface $node)
 {
     return AccessResult::allowedIf($this->bookManager->checkNodeIsRemovable($node))->addCacheableDependency($node);
 }
 /**
  * Checks access for removing the node from its book.
  *
  * @param \Drupal\node\NodeInterface $node
  *   The node requested to be removed from its book.
  *
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
 public function access(NodeInterface $node)
 {
     return AccessResult::allowedIf($this->bookManager->checkNodeIsRemovable($node))->cacheUntilEntityChanges($node);
 }
 /**
  * Checks access for removing the node from its book.
  *
  * @param \Drupal\node\NodeInterface $node
  *   The node requested to be removed from its book.
  *
  * @return string
  *   A \Drupal\Core\Access\AccessInterface constant value.
  */
 public function access(NodeInterface $node)
 {
     return $this->bookManager->checkNodeIsRemovable($node) ? static::ALLOW : static::DENY;
 }