コード例 #1
0
ファイル: ViewEditForm.php プロジェクト: alnutile/drunatra
 /**
  * Form submission handler for the 'cancel' action.
  *
  * @param array $form
  *   An associative array containing the structure of the form.
  * @param array $form_state
  *   A reference to a keyed array containing the current state of the form.
  */
 public function cancel(array $form, array &$form_state)
 {
     // Remove this view from cache so edits will be lost.
     $view = $this->entity;
     $this->tempStore->delete($view->id());
     $form_state['redirect_route']['route_name'] = 'views_ui.list';
 }
コード例 #2
0
ファイル: ViewEditForm.php プロジェクト: anyforsoft/csua_d8
 /**
  * Form submission handler for the 'cancel' action.
  *
  * @param array $form
  *   An associative array containing the structure of the form.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  */
 public function cancel(array $form, FormStateInterface $form_state)
 {
     // Remove this view from cache so edits will be lost.
     $view = $this->entity;
     $this->tempStore->delete($view->id());
     $form_state->setRedirect('views_ui.list');
 }
コード例 #3
0
 /**
  * Tests the deleteIfOwner() method.
  *
  * @covers ::deleteIfOwner()
  */
 public function testDeleteIfOwner()
 {
     $this->lock->expects($this->once())->method('acquire')->with('test_2')->will($this->returnValue(TRUE));
     $this->keyValue->expects($this->at(0))->method('get')->with('test_1')->will($this->returnValue(FALSE));
     $this->keyValue->expects($this->at(1))->method('get')->with('test_2')->will($this->returnValue($this->ownObject));
     $this->keyValue->expects($this->at(2))->method('delete')->with('test_2');
     $this->keyValue->expects($this->at(3))->method('get')->with('test_3')->will($this->returnValue($this->otherObject));
     $this->assertTrue($this->tempStore->deleteIfOwner('test_1'));
     $this->assertTrue($this->tempStore->deleteIfOwner('test_2'));
     $this->assertFalse($this->tempStore->deleteIfOwner('test_3'));
 }
コード例 #4
0
 /**
  * Form submission handler for the Preview button.
  */
 public function submitPreview($form, FormStateInterface $form_state)
 {
     // Rebuild the form with a pristine $view object.
     $view = $this->entity;
     // Attempt to load the view from temp store, otherwise create a new one.
     if (!($new_view = $this->tempStore->get($view->id()))) {
         $new_view = new ViewUI($view);
     }
     $form_state['build_info']['args'][0] = $new_view;
     $form_state['show_preview'] = TRUE;
     $form_state['rebuild'] = TRUE;
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     $this->tempStore->delete($this->entity->id());
     $form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
     drupal_set_message($this->t('The lock has been broken and you may now edit this view.'));
 }
コード例 #6
0
 /**
  * {@inheritdoc}
  */
 public function executeMultiple(array $entities)
 {
     $this->tempStore->set(\Drupal::currentUser()->id(), $entities);
 }
コード例 #7
0
ファイル: BreakLockForm.php プロジェクト: shumer/blog
 /**
  * {@inheritdoc}
  */
 public function submit(array $form, array &$form_state)
 {
     $this->tempStore->delete($this->entity->id());
     $form_state['redirect_route'] = $this->entity->urlInfo('edit-form');
     drupal_set_message($this->t('The lock has been broken and you may now edit this view.'));
 }
コード例 #8
0
ファイル: DeleteFeed.php プロジェクト: alnutile/drunatra
 /**
  * {@inheritdoc}
  */
 public function executeMultiple(array $entities)
 {
     $this->tempStore->set($this->user->id(), $entities);
 }