当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentEntityBase::access方法代码示例

本文整理汇总了PHP中Drupal\Core\Entity\ContentEntityBase::access方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentEntityBase::access方法的具体用法?PHP ContentEntityBase::access怎么用?PHP ContentEntityBase::access使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Entity\ContentEntityBase的用法示例。


在下文中一共展示了ContentEntityBase::access方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: access

  /**
   * {@inheritdoc}
   */
  public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
    if ($operation == 'create') {
      return parent::access($operation, $account, $return_as_object);
    }

    return \Drupal::entityManager()
      ->getAccessControlHandler($this->entityTypeId)
      ->access($this, $operation, $account, $return_as_object);
  }
开发者ID:jkyto,项目名称:agolf,代码行数:12,代码来源:EntitySubqueue.php

示例2: testAccess

 /**
  * @covers ::access
  */
 public function testAccess()
 {
     $access = $this->getMock('\\Drupal\\Core\\Entity\\EntityAccessControllerInterface');
     $operation = $this->randomName();
     $access->expects($this->at(0))->method('access')->with($this->entity, $operation)->will($this->returnValue(TRUE));
     $access->expects($this->at(1))->method('createAccess')->will($this->returnValue(TRUE));
     $this->entityManager->expects($this->exactly(2))->method('getAccessController')->will($this->returnValue($access));
     $this->assertTrue($this->entity->access($operation));
     $this->assertTrue($this->entity->access('create'));
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:13,代码来源:ContentEntityBaseUnitTest.php

示例3: testAccess

 /**
  * @covers ::access
  */
 public function testAccess()
 {
     $access = $this->getMock('\\Drupal\\Core\\Entity\\EntityAccessControlHandlerInterface');
     $operation = $this->randomMachineName();
     $access->expects($this->at(0))->method('access')->with($this->entity, $operation)->will($this->returnValue(TRUE));
     $access->expects($this->at(1))->method('access')->with($this->entity, $operation)->will($this->returnValue(AccessResult::allowed()));
     $access->expects($this->at(2))->method('createAccess')->will($this->returnValue(TRUE));
     $access->expects($this->at(3))->method('createAccess')->will($this->returnValue(AccessResult::allowed()));
     $this->entityManager->expects($this->exactly(4))->method('getAccessControlHandler')->will($this->returnValue($access));
     $this->assertTrue($this->entity->access($operation));
     $this->assertEquals(AccessResult::allowed(), $this->entity->access($operation, NULL, TRUE));
     $this->assertTrue($this->entity->access('create'));
     $this->assertEquals(AccessResult::allowed(), $this->entity->access('create', NULL, TRUE));
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:17,代码来源:ContentEntityBaseUnitTest.php

示例4: access

  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {

    return parent::access($operation, $account, $return_as_object); // TODO: Change the autogenerated stub
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:4,代码来源:EFormSubmission.php

示例5: access

 /**
  * {@inheritdoc}
  */
 public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE)
 {
     // This override exists to set the operation to the default value "view".
     return parent::access($operation, $account, $return_as_object);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:8,代码来源:Node.php

示例6: access

 /**
  * {@inheritdoc}
  */
 public function access($operation = 'view', AccountInterface $account = NULL)
 {
     if ($operation == 'create') {
         return parent::access($operation, $account);
     }
     return \Drupal::entityManager()->getAccessController($this->entityTypeId)->access($this, $operation, $this->prepareLangcode(), $account);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:Node.php


注:本文中的Drupal\Core\Entity\ContentEntityBase::access方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。