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


PHP FieldDefinitionInterface::getTargetEntityTypeId方法代码示例

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


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

示例1: isApplicable

 /**
  * {@inheritdoc}
  */
 public static function isApplicable(FieldDefinitionInterface $field_definition)
 {
     $entity_form_display = entity_get_form_display($field_definition->getTargetEntityTypeId(), $field_definition->getTargetBundle(), 'default');
     $widget = $entity_form_display->getRenderer($field_definition->getName());
     $widget_id = $widget->getBaseId();
     if ($field_definition->isList() && $widget_id == 'video_upload') {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:kallehauge,项目名称:iamkallehauge.com,代码行数:13,代码来源:VideoPlayerListFormatter.php

示例2: onFieldDefinitionDelete

 /**
  * {@inheritdoc}
  */
 public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition)
 {
     $entity_type_id = $field_definition->getTargetEntityTypeId();
     $bundle = $field_definition->getTargetBundle();
     $field_name = $field_definition->getName();
     // Notify the storage about the field deletion.
     $this->getStorage($entity_type_id)->onFieldDefinitionDelete($field_definition);
     // Unset the bundle from the bundle field map key value collection.
     $bundle_field_map = $this->keyValueFactory->get('entity.definitions.bundle_field_map')->get($entity_type_id);
     unset($bundle_field_map[$field_name]['bundles'][$bundle]);
     if (empty($bundle_field_map[$field_name]['bundles'])) {
         // If there are no bundles left, remove the field from the map.
         unset($bundle_field_map[$field_name]);
     }
     $this->keyValueFactory->get('entity.definitions.bundle_field_map')->set($entity_type_id, $bundle_field_map);
     // Delete the cache entry.
     $this->cacheBackend->delete('entity_field_map');
     // If the field map is initialized, update it as well, so that calls to it
     // do not have to rebuild it again.
     if ($this->fieldMap) {
         unset($this->fieldMap[$entity_type_id][$field_name]['bundles'][$bundle]);
         if (empty($this->fieldMap[$entity_type_id][$field_name]['bundles'])) {
             unset($this->fieldMap[$entity_type_id][$field_name]);
         }
     }
 }
开发者ID:RealLukeMartin,项目名称:drupal8tester,代码行数:29,代码来源:EntityManager.php

示例3: isApplicable

 /**
  * {@inheritdoc}
  */
 public static function isApplicable(FieldDefinitionInterface $field_definition)
 {
     return ($field_definition->getTargetEntityTypeId() === 'aggregator_item' || $field_definition->getTargetEntityTypeId() === 'aggregator_feed') && $field_definition->getName() === 'title';
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:7,代码来源:AggregatorTitleFormatter.php

示例4: isApplicable

 /**
  * {@inheritdoc}
  */
 public static function isApplicable(FieldDefinitionInterface $field_definition)
 {
     return $field_definition->getTargetEntityTypeId() === 'file';
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:7,代码来源:BaseFieldFileFormatterBase.php

示例5: isApplicable

 /**
  * {@inheritdoc}
  */
 public static function isApplicable(FieldDefinitionInterface $field_definition)
 {
     return $field_definition->getName() === 'name' && $field_definition->getTargetEntityTypeId() === 'comment';
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:7,代码来源:AuthorNameFormatter.php

示例6: isApplicable

 /**
  * {@inheritdoc}
  */
 public static function isApplicable(FieldDefinitionInterface $field_definition)
 {
     $entity_type = $field_definition->getTargetEntityTypeId();
     $field_name = $field_definition->getName();
     return $entity_type == 'commerce_order' && $field_name == 'line_items';
 }
开发者ID:alexburrows,项目名称:cream-2.x,代码行数:9,代码来源:LineItemTable.php

示例7: isApplicable

 /**
  * {@inheritdoc}
  */
 public static function isApplicable(FieldDefinitionInterface $field_definition)
 {
     $has_cart = \Drupal::moduleHandler()->moduleExists('commerce_cart');
     $entity_type = $field_definition->getTargetEntityTypeId();
     $field_name = $field_definition->getName();
     return $has_cart && $entity_type == 'commerce_product' && $field_name == 'variations';
 }
开发者ID:alexburrows,项目名称:cream-2.x,代码行数:10,代码来源:AddToCartFormatter.php


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