當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityStorageInterface::loadRevision方法代碼示例

本文整理匯總了PHP中Drupal\Core\Entity\EntityStorageInterface::loadRevision方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityStorageInterface::loadRevision方法的具體用法?PHP EntityStorageInterface::loadRevision怎麽用?PHP EntityStorageInterface::loadRevision使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Entity\EntityStorageInterface的用法示例。


在下文中一共展示了EntityStorageInterface::loadRevision方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, array &$form_state, $node_revision = NULL)
 {
     $this->revision = $this->nodeStorage->loadRevision($node_revision);
     $form = parent::buildForm($form, $form_state);
     // @todo Convert to getCancelRoute() after http://drupal.org/node/1863906.
     $form['actions']['cancel']['#href'] = 'node/' . $this->revision->id() . '/revisions';
     return $form;
 }
開發者ID:alnutile,項目名稱:drunatra,代碼行數:11,代碼來源:NodeRevisionRevertForm.php

示例2: access

 /**
  * Checks routing access for the node revision.
  *
  * @param \Symfony\Component\Routing\Route $route
  *   The route to check against.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The currently logged in account.
  * @param int $node_revision
  *   (optional) The node revision ID. If not specified, but $node is, access
  *   is checked for that object's revision.
  * @param \Drupal\node\NodeInterface $node
  *   (optional) A node object. Used for checking access to a node's default
  *   revision when $node_revision is unspecified. Ignored when $node_revision
  *   is specified. If neither $node_revision nor $node are specified, then
  *   access is denied.
  *
  * @return string
  *   A \Drupal\Core\Access\AccessInterface constant value.
  */
 public function access(Route $route, AccountInterface $account, $node_revision = NULL, NodeInterface $node = NULL)
 {
     if ($node_revision) {
         $node = $this->nodeStorage->loadRevision($node_revision);
     }
     $operation = $route->getRequirement('_access_node_revision');
     return $node && $this->checkAccess($node, $account, $operation) ? static::ALLOW : static::DENY;
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:27,代碼來源:NodeRevisionAccessCheck.php

示例3: access

 /**
  * Checks routing access for the node revision.
  *
  * @param \Symfony\Component\Routing\Route $route
  *   The route to check against.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The currently logged in account.
  * @param int $node_revision
  *   (optional) The node revision ID. If not specified, but $node is, access
  *   is checked for that object's revision.
  * @param \Drupal\node\NodeInterface $node
  *   (optional) A node object. Used for checking access to a node's default
  *   revision when $node_revision is unspecified. Ignored when $node_revision
  *   is specified. If neither $node_revision nor $node are specified, then
  *   access is denied.
  *
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
 public function access(Route $route, AccountInterface $account, $node_revision = NULL, NodeInterface $node = NULL)
 {
     if ($node_revision) {
         $node = $this->nodeStorage->loadRevision($node_revision);
     }
     $operation = $route->getRequirement('_access_node_revision');
     return AccessResult::allowedIf($node && $this->checkAccess($node, $account, $operation))->cachePerRole();
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:27,代碼來源:NodeRevisionAccessCheck.php

示例4: testGetEntityUpdateRevision

 /**
  * Test that revision updates update.
  *
  * @covers ::getEntity
  */
 public function testGetEntityUpdateRevision()
 {
     $destination = $this->getEntityRevisionDestination([]);
     $entity = $this->prophesize('\\Drupal\\Core\\Entity\\EntityInterface')->willImplement('\\Drupal\\Core\\Entity\\RevisionableInterface');
     $entity_type = $this->prophesize('\\Drupal\\Core\\Entity\\EntityTypeInterface');
     $entity_type->getKey('id')->willReturn('nid');
     $entity_type->getKey('revision')->willReturn('vid');
     $this->storage->getEntityType()->willReturn($entity_type->reveal());
     // Assert we load the correct revision.
     $this->storage->loadRevision(2)->shouldBeCalled()->willReturn($entity->reveal());
     // Make sure its set as an update and not the default revision.
     $entity->setNewRevision(FALSE)->shouldBeCalled();
     $entity->isDefaultRevision(FALSE)->shouldBeCalled();
     $row = new Row(['nid' => 1, 'vid' => 2], ['nid' => 1, 'vid' => 2]);
     $row->setDestinationProperty('vid', 2);
     $this->assertEquals($entity->reveal(), $destination->getEntity($row, []));
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:22,代碼來源:EntityRevisionTest.php

示例5: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, $node_revision = NULL)
 {
     $this->revision = $this->nodeStorage->loadRevision($node_revision);
     $form = parent::buildForm($form, $form_state);
     return $form;
 }
開發者ID:HakS,項目名稱:drupal8_training,代碼行數:9,代碼來源:NodeRevisionDeleteForm.php

示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, $support_ticket_revision = NULL)
 {
     $this->revision = $this->supportTicketStorage->loadRevision($support_ticket_revision);
     $form = parent::buildForm($form, $form_state);
     return $form;
 }
開發者ID:justincletus,項目名稱:webdrupalpro,代碼行數:9,代碼來源:SupportTicketRevisionDeleteForm.php


注:本文中的Drupal\Core\Entity\EntityStorageInterface::loadRevision方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。