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


PHP EntityListBuilder::getOperations方法代码示例

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


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

示例1: getOperations

 /**
  * {@inheritdoc}
  */
 public function getOperations(EntityInterface $entity)
 {
     $operations = parent::getOperations($entity);
     if (isset($operations['edit'])) {
         $destination = drupal_get_destination();
         $operations['edit']['query'] = $destination;
     }
     return $operations;
 }
开发者ID:shumer,项目名称:blog,代码行数:12,代码来源:UserListBuilder.php

示例2: testGetOperations

 /**
  * @covers ::getOperations
  */
 public function testGetOperations()
 {
     $operation_name = $this->randomMachineName();
     $operations = array($operation_name => array('title' => $this->randomMachineName()));
     $this->moduleHandler->expects($this->once())->method('invokeAll')->with('entity_operation', array($this->role))->will($this->returnValue($operations));
     $this->moduleHandler->expects($this->once())->method('alter')->with('entity_operation');
     $this->container->set('module_handler', $this->moduleHandler);
     $this->role->expects($this->any())->method('access')->will($this->returnValue(AccessResult::allowed()));
     $this->role->expects($this->any())->method('hasLinkTemplate')->will($this->returnValue(TRUE));
     $url = $this->getMockBuilder('\\Drupal\\Core\\Url')->disableOriginalConstructor()->getMock();
     $url->expects($this->any())->method('toArray')->will($this->returnValue(array()));
     $this->role->expects($this->any())->method('urlInfo')->will($this->returnValue($url));
     $list = new EntityListBuilder($this->entityType, $this->roleStorage, $this->moduleHandler);
     $list->setStringTranslation($this->translationManager);
     $operations = $list->getOperations($this->role);
     $this->assertInternalType('array', $operations);
     $this->assertArrayHasKey('edit', $operations);
     $this->assertInternalType('array', $operations['edit']);
     $this->assertArrayHasKey('title', $operations['edit']);
     $this->assertArrayHasKey('delete', $operations);
     $this->assertInternalType('array', $operations['delete']);
     $this->assertArrayHasKey('title', $operations['delete']);
     $this->assertArrayHasKey($operation_name, $operations);
     $this->assertInternalType('array', $operations[$operation_name]);
     $this->assertArrayHasKey('title', $operations[$operation_name]);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:29,代码来源:EntityListBuilderTest.php

示例3: getOperations

 /**
  * {@inheritdoc}
  */
 public function getOperations(EntityInterface $entity)
 {
     $operations = parent::getOperations($entity);
     if (isset($operations['edit'])) {
         $destination = $this->redirectDestination->getAsArray();
         $operations['edit']['query'] = $destination;
     }
     return $operations;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:UserListBuilder.php

示例4: getOperations

 /**
  * {@inheritdoc}
  */
 public function getOperations(EntityInterface $entity)
 {
     $operations = parent::getOperations($entity);
     foreach ($operations as &$operation) {
         $operation['query'] = $this->redirectDestination->getAsArray();
     }
     return $operations;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:11,代码来源:RuleListBuilder.php

示例5: getOperations

 /**
  * {@inheritdoc}
  */
 public function getOperations(EntityInterface $entity)
 {
     $operations = parent::getOperations($entity);
     if (!$entity->isDefault()) {
         $operations['set_default'] = ['title' => $this->t('Mark as default'), 'url' => $entity->toUrl('set-default'), 'parameter' => $entity];
     }
     return $operations;
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:11,代码来源:ProfileListBuilder.php


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