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


PHP EntityTypeInterface::id方法代码示例

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


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

示例1: 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

示例2: revisionDeleteRoute

 protected function revisionDeleteRoute(EntityTypeInterface $entity_type)
 {
     $route = new Route($entity_type->getLinkTemplate('revision-delete'));
     $route->setDefault('_form', 'Drupal\\content_entity_base\\Entity\\Form\\EntityRevisionDeleteForm');
     $route->setDefault('_title', 'Delete earlier revision');
     $route->setRequirement('_entity_access_revision', $entity_type->id() . '.delete');
     $route->setOption('parameters', [$entity_type->id() => ['type' => 'entity:' . $entity_type->id()], $entity_type->id() . '_revision' => ['type' => 'entity_revision:' . $entity_type->id()]]);
     return $route;
 }
开发者ID:heddn,项目名称:content_entity_base,代码行数:9,代码来源:RevisionHtmlRouteProvider.php

示例3: addFormRoute

 /**
  * Returns the add 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 addFormRoute(EntityTypeInterface $entity_type)
 {
     if ($entity_type->hasLinkTemplate('add-form')) {
         $route = new Route($entity_type->getLinkTemplate('add-form'));
         $route->setDefault('_controller', '\\Drupal\\entity\\Controller\\EntityCreateController::addForm');
         $route->setDefault('_title_callback', '\\Drupal\\entity\\Controller\\EntityCreateController::addFormTitle');
         $route->setDefault('entity_type_id', $entity_type->id());
         $route->setRequirement('_entity_create_access', $entity_type->id());
         return $route;
     }
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:20,代码来源:CreateHtmlRouteProvider.php

示例4: getRevisionViewRoute

 /**
  * Gets the entity revision view route.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type.
  *
  * @return \Symfony\Component\Routing\Route|null
  *   The generated route, if available.
  */
 protected function getRevisionViewRoute(EntityTypeInterface $entity_type)
 {
     if ($entity_type->hasLinkTemplate('revision')) {
         $entity_type_id = $entity_type->id();
         $route = new Route($entity_type->getLinkTemplate('revision'));
         $route->addDefaults(['_controller' => '\\Drupal\\entity\\Controller\\RevisionController::view', '_title_callback' => '\\Drupal\\Core\\Entity\\Controller\\EntityController::title']);
         $route->addRequirements(['_entity_access_revision' => "{$entity_type_id}.view"]);
         $route->setOption('parameters', [$entity_type->id() => ['type' => 'entity:' . $entity_type->id()], $entity_type->id() . '_revision' => ['type' => 'entity_revision:' . $entity_type->id()]]);
         return $route;
     }
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:20,代码来源:RevisionRouteProvider.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: submitForm

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    /** @var \Drupal\entity_clone\EntityClone\EntityCloneInterface $entity_clone_handler */
    $entity_clone_handler = $this->entityTypeManager->getHandler($this->entityTypeDefinition->id(), 'entity_clone');
    if ($this->entityTypeManager->hasHandler($this->entityTypeDefinition->id(), 'entity_clone_form')) {
      $entity_clone_form_handler = $this->entityTypeManager->getHandler($this->entityTypeDefinition->id(), 'entity_clone_form');
    }

    $properties = [];
    if (isset($entity_clone_form_handler) && $entity_clone_form_handler) {
      $properties = $entity_clone_form_handler->getNewValues($form_state);
    }

    $cloned_entity = $entity_clone_handler->cloneEntity($this->entity, $this->entity->createDuplicate(), $properties);

    drupal_set_message($this->stringTranslationManager->translate('The entity <em>@entity (@entity_id)</em> of type <em>@type</em> was cloned', [
      '@entity' => $this->entity->label(),
      '@entity_id' => $this->entity->id(),
      '@type' => $this->entity->getEntityTypeId(),
    ]));

    if ($cloned_entity && $cloned_entity->hasLinkTemplate('canonical')) {
      $form_state->setRedirect($cloned_entity->toUrl()
        ->getRouteName(), $cloned_entity->toUrl()->getRouteParameters());
    }

    $form_state->setRedirect('<front>');
  }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:30,代码来源:EntityCloneForm.php

示例7: 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('scheduled_updates.update_utils')
   );
 }
开发者ID:joebachana,项目名称:usatne,代码行数:10,代码来源:ScheduledUpdateListBuilder.php

示例8: __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

示例9: 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

示例10: getViewsData

 /**
  * {@inheritdoc}
  */
 public function getViewsData()
 {
     $data = [];
     // @todo In theory we should use the data table as base table, as this would
     //   save one pointless join (and one more for every relationship).
     // @see https://drupal.org/node/2337509
     $base_table = $this->entityType->getBaseTable();
     $base_field = $this->entityType->getKey('id');
     $data_table = $this->entityType->getDataTable();
     $revision_table = $this->entityType->getRevisionTable();
     $revision_data_table = $this->entityType->getRevisionDataTable();
     $revision_field = $this->entityType->getKey('revision');
     // Setup base information of the views data.
     $data[$base_table]['table']['entity type'] = $this->entityType->id();
     $data[$base_table]['table']['group'] = $this->entityType->getLabel();
     $data[$base_table]['table']['base'] = ['field' => $base_field, 'title' => $this->entityType->getLabel()];
     if ($label_key = $this->entityType->getKey('label')) {
         if ($data_table) {
             $data[$base_table]['table']['base']['defaults'] = array('field' => $label_key, 'table' => $data_table);
         } else {
             $data[$base_table]['table']['base']['defaults'] = array('field' => $label_key);
         }
     }
     // Setup relations to the revisions/property data.
     if ($data_table) {
         $data[$data_table]['table']['join'][$base_table] = ['left_field' => $base_field, 'field' => $base_field, 'type' => 'INNER'];
         $data[$data_table]['table']['entity type'] = $this->entityType->id();
         $data[$data_table]['table']['group'] = $this->entityType->getLabel();
     }
     if ($revision_table) {
         $data[$revision_table]['table']['entity type'] = $this->entityType->id();
         $data[$revision_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]);
         $data[$revision_table]['table']['base'] = array('field' => $revision_field, 'title' => $this->t('@entity_type revisions', array('@entity_type' => $this->entityType->getLabel())));
         // Join the revision table to the base table.
         $data[$revision_table]['table']['join'][$base_table] = array('left_field' => $revision_field, 'field' => $revision_field, 'type' => 'INNER');
         if ($revision_data_table) {
             $data[$revision_data_table]['table']['entity type'] = $this->entityType->id();
             $data[$revision_data_table]['table']['group'] = $this->t('@entity_type revision', ['@entity_type' => $this->entityType->getLabel()]);
             $data[$revision_data_table]['table']['join'][$revision_table] = array('left_field' => $revision_field, 'field' => $revision_field, 'type' => 'INNER');
         }
     }
     // Load all typed data definitions of all fields. This should cover each of
     // the entity base, revision, data tables.
     $field_definitions = $this->entityManager->getBaseFieldDefinitions($this->entityType->id());
     if ($table_mapping = $this->storage->getTableMapping()) {
         // Iterate over each table we have so far and collect field data for each.
         // Based on whether the field is in the field_definitions provided by the
         // entity manager.
         // @todo We should better just rely on information coming from the entity
         //   storage.
         // @todo https://drupal.org/node/2337511
         foreach ($table_mapping->getTableNames() as $table) {
             foreach ($table_mapping->getFieldNames($table) as $field_name) {
                 $this->mapFieldDefinition($table, $field_name, $field_definitions[$field_name], $table_mapping, $data[$table]);
             }
         }
     }
     return $data;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:62,代码来源:EntityViewsData.php

示例11: __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

示例12: __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

示例13: 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

示例14: evaluate

 /**
  * {@inheritdoc}
  */
 public function evaluate()
 {
     if (empty($this->configuration['bundles']) && !$this->isNegated()) {
         return TRUE;
     }
     /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
     $entity = $this->getContextValue($this->bundleOf->id());
     return !empty($this->configuration['bundles'][$entity->bundle()]);
 }
开发者ID:isramv,项目名称:camp-gdl,代码行数:12,代码来源:EntityBundle.php

示例15: setUpStorage

 /**
  * Sets up the storage accessed via the entity type manager in the form.
  *
  * @return \Prophecy\Prophecy\ObjectProphecy
  *   The storage prophecy.
  */
 protected function setUpStorage()
 {
     $storage = $this->prophesize(EntityStorageInterface::class);
     $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
     $entity_type_manager->getDefinition($this->entityType->id())->willReturn($this->entityType);
     $entity_type_manager->getStorage($this->entityType->id())->willReturn($storage->reveal());
     $this->entityForm->setEntityTypeManager($entity_type_manager->reveal());
     return $storage;
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:15,代码来源:EntityFormTest.php


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