本文整理匯總了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;
}
示例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]);
}
}
}
示例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';
}
示例4: isApplicable
/**
* {@inheritdoc}
*/
public static function isApplicable(FieldDefinitionInterface $field_definition)
{
return $field_definition->getTargetEntityTypeId() === 'file';
}
示例5: isApplicable
/**
* {@inheritdoc}
*/
public static function isApplicable(FieldDefinitionInterface $field_definition)
{
return $field_definition->getName() === 'name' && $field_definition->getTargetEntityTypeId() === 'comment';
}
示例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';
}
示例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';
}