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


PHP Entity\EntityTypeInterface类代码示例

本文整理汇总了PHP中Drupal\Core\Entity\EntityTypeInterface的典型用法代码示例。如果您正苦于以下问题:PHP EntityTypeInterface类的具体用法?PHP EntityTypeInterface怎么用?PHP EntityTypeInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createInstance

 /**
  * {@inheritdoc}
  */
 public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
   return new static(
     $entity_type,
     $container->get('entity.manager')->getStorage($entity_type->id()),
     $container->get('date.formatter')
   );
 }
开发者ID:housineali,项目名称:drpl8_dv,代码行数:10,代码来源:ProfileListBuilder.php

示例2: getDownloadRoute

 /**
  * Build the route for the actual download path.
  */
 protected function getDownloadRoute(EntityTypeInterface $entity_type)
 {
     $entity_type_id = $entity_type->id();
     $route = new Route("/rdf-export/{$entity_type_id}/{{$entity_type_id}}/{export_format}");
     $route->addDefaults(['_controller' => '\\Drupal\\rdf_export\\Controller\\RdfExportController::download', '_title' => 'RDF Export'])->addRequirements(['_permission' => 'export rdf metadata'])->setOption('entity_type_id', $entity_type_id)->setOption('parameters', [$entity_type_id => ['type' => 'entity:' . $entity_type_id]]);
     return $route;
 }
开发者ID:ec-europa,项目名称:joinup-dev,代码行数:10,代码来源:RouteSubscriber.php

示例3: isModeratableBundle

 /**
  * {@inheritdoc}
  */
 public function isModeratableBundle(EntityTypeInterface $entity_type, $bundle)
 {
     if ($bundle_entity = $this->loadBundleEntity($entity_type->getBundleEntityType(), $bundle)) {
         return $bundle_entity->getThirdPartySetting('workbench_moderation', 'enabled', FALSE);
     }
     return FALSE;
 }
开发者ID:tedbow,项目名称:scheduled-updates-demo,代码行数:10,代码来源:ModerationInformation.php

示例4: __construct

 /**
  * Constructs a new EntityViewBuilder.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type definition.
  * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
  *   The entity manager service.
  * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
  *   The language manager.
  */
 public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager)
 {
     $this->entityTypeId = $entity_type->id();
     $this->entityType = $entity_type;
     $this->entityManager = $entity_manager;
     $this->languageManager = $language_manager;
 }
开发者ID:brstde,项目名称:gap1,代码行数:17,代码来源:EntityViewBuilder.php

示例5: createInstance

 /**
  * {@inheritdoc}
  */
 public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
   return new static(
     $container->get('entity.manager'),
     $container->get('module_handler'),
     $entity_type->id()
   );
 }
开发者ID:housineali,项目名称:drpl8_dv,代码行数:10,代码来源:EntityInlineEntityFormHandler.php

示例6: shouldModerateEntitiesOfBundle

 /**
  * {@inheritdoc}
  */
 public function shouldModerateEntitiesOfBundle(EntityTypeInterface $entity_type, $bundle)
 {
     if ($bundle_entity = $this->loadBundleEntity($entity_type->getBundleEntityType(), $bundle)) {
         return $bundle_entity->getThirdPartySetting('content_moderation', 'enabled', FALSE);
     }
     return FALSE;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:ModerationInformation.php

示例7: __construct

 /**
  * Constructs a new EntityViewBuilder.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type definition.
  * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
  *   The entity manager service.
  * @param \Drupal\panelizer\Plugin\PanelizerEntityManager $panelizer_manager
  *   The Panelizer entity manager.
  * @param \Drupal\Panels\PanelsDisplayManagerInterface $panels_manager
  *   The Panels display manager.
  */
 public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, PanelizerEntityManager $panelizer_manager, PanelsDisplayManagerInterface $panels_manager)
 {
     $this->entityTypeId = $entity_type->id();
     $this->entityType = $entity_type;
     $this->entityTypeManager = $entity_type_manager;
     $this->panelizerManager = $panelizer_manager;
     $this->panelsManager = $panels_manager;
 }
开发者ID:mglaman,项目名称:panelizer-d8-prototype,代码行数:20,代码来源:PanelizerEntityViewBuilder.php

示例8: createInstance

 /**
  * {@inheritdoc}
  */
 public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
   return new static(
     $entity_type,
     $container->get('entity.manager')->getStorage($entity_type->id()),
     $container->get('url_generator'),
     $container->get('string_translation')
   );
 }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:11,代码来源:BlocktabsListBuilder.php

示例9: __construct

 /**
  * Constructs an EntityStorageBase instance.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type definition.
  */
 public function __construct(EntityTypeInterface $entity_type)
 {
     $this->entityTypeId = $entity_type->id();
     $this->entityType = $entity_type;
     $this->idKey = $this->entityType->getKey('id');
     $this->uuidKey = $this->entityType->getKey('uuid');
     $this->entityClass = $this->entityType->getClass();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:14,代码来源:EntityStorageBase.php

示例10: getModerationFormRoute

 /**
  * Gets the moderation-form route.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type.
  *
  * @return \Symfony\Component\Routing\Route|null
  *   The generated route, if available.
  */
 protected function getModerationFormRoute(EntityTypeInterface $entity_type)
 {
     if ($entity_type->hasLinkTemplate('moderation-form') && $entity_type->getFormClass('moderation')) {
         $entity_type_id = $entity_type->id();
         $route = new Route($entity_type->getLinkTemplate('moderation-form'));
         $route->setDefaults(['_entity_form' => "{$entity_type_id}.moderation", '_title' => 'Moderation'])->setRequirement('_permission', 'administer moderation states')->setOption('parameters', [$entity_type_id => ['type' => 'entity:' . $entity_type_id]]);
         return $route;
     }
 }
开发者ID:tedbow,项目名称:scheduled-updates-demo,代码行数:18,代码来源:EntityTypeModerationRouteProvider.php

示例11: getDevelRenderRoute

 /**
  * Gets the devel render route.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type.
  *
  * @return \Symfony\Component\Routing\Route|null
  *   The generated route, if available.
  */
 protected function getDevelRenderRoute(EntityTypeInterface $entity_type)
 {
     if ($devel_render = $entity_type->getLinkTemplate('devel-render')) {
         $entity_type_id = $entity_type->id();
         $route = new Route($devel_render);
         $route->addDefaults(['_controller' => '\\Drupal\\devel\\Controller\\DevelController::entityRender', '_title' => 'Devel Render'])->addRequirements(['_permission' => 'access devel information'])->setOption('_admin_route', TRUE)->setOption('_devel_entity_type_id', $entity_type_id)->setOption('parameters', [$entity_type_id => ['type' => 'entity:' . $entity_type_id]]);
         return $route;
     }
 }
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:18,代码来源:RouteSubscriber.php

示例12: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $this->entityTypeId = $this->randomMachineName();
     $this->provider = $this->randomMachineName();
     $this->entityType = $this->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
     $this->entityType->expects($this->any())->method('getProvider')->will($this->returnValue($this->provider));
     $this->entityManager = $this->getMock('\\Drupal\\Core\\Entity\\EntityManagerInterface');
     $this->entityManager->expects($this->any())->method('getDefinition')->with($this->entityTypeId)->will($this->returnValue($this->entityType));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:ImageStyleTest.php

示例13: addFormRoute

 protected function addFormRoute(EntityTypeInterface $entity_type)
 {
     $route = new Route('entity.' . $entity_type->id() . '.add-form');
     $route->setDefault('_controller', '\\Drupal\\content_entity_base\\Entity\\Controller\\EntityBaseController::addForm');
     $route->setDefault('_title_callback', '\\Drupal\\content_entity_base\\Entity\\Controller\\EntityBaseController::getAddFormTitle');
     $route->setDefault('entity_type', $entity_type->id());
     $route->setRequirement('_entity_create_access', $entity_type->id());
     return $route;
 }
开发者ID:heddn,项目名称:content_entity_base,代码行数:9,代码来源:CrudUiRouteProvider.php

示例14: createInstance

 /**
  * {@inheritdoc}
  */
 public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
   return new static(
     $entity_type,
     $container->get('entity.manager')->getStorage($entity_type->id()),
     $container->get('theme.manager'),
     $container->get('form_builder'),
     $container->get('entity.manager')->getStorage('block_visibility_group'),
     $container->get('state')
   );
 }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:13,代码来源:BlockVisibilityGroupedListBuilder.php

示例15: entityBaseFieldInfo

 /**
  * Adds base field info to an entity type.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   Entity type for adding base fields to.
  *
  * @return \Drupal\Core\Field\BaseFieldDefinition[]
  *   New fields added by moderation state.
  */
 public function entityBaseFieldInfo(EntityTypeInterface $entity_type)
 {
     if ($entity_type->isRevisionable()) {
         $fields = [];
         // @todo write a test for this.
         $fields['moderation_state'] = BaseFieldDefinition::create('entity_reference')->setLabel(t('Moderation state'))->setDescription(t('The moderation state of this piece of content.'))->setSetting('target_type', 'moderation_state')->setTargetEntityTypeId($entity_type->id())->setRevisionable(TRUE)->setDisplayOptions('view', ['label' => 'hidden', 'type' => 'string', 'weight' => -5])->setDisplayOptions('form', ['type' => 'moderation_state_default', 'weight' => 5, 'settings' => []])->addConstraint('ModerationState', [])->setDisplayConfigurable('form', FALSE)->setDisplayConfigurable('view', TRUE);
         return $fields;
     }
     return [];
 }
开发者ID:tedbow,项目名称:scheduled-updates-demo,代码行数:19,代码来源:BaseFieldInfo.php


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