當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。