当前位置: 首页>>代码示例>>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;未经允许,请勿转载。