protected function DataProviderEntity::getFieldsFromPublicNameItem in RESTful 7.2
Get the (reference) field information for a single item.
Parameters
ResourceFieldInterface $resource_field: The resource field.
Return value
array An array containing the following keys:
- 'name': Drupal's internal field name. Ex: field_article_related
- 'type': Either a field or a property.
- 'entity_type': The entity type this field points to. Not populated if the field is not a reference (for instance the destination field used in the where clause).
- 'bundles': The allowed bundles for this field. Not populated if the field is not a reference (for instance the destination field used in the where clause).
Throws
\Drupal\restful\Exception\BadRequestException
1 call to DataProviderEntity::getFieldsFromPublicNameItem()
- DataProviderEntity::getFieldsInfoFromPublicName in src/
Plugin/ resource/ DataProvider/ DataProviderEntity.php - Transform the nested public name into an array of Drupal field information.
File
- src/
Plugin/ resource/ DataProvider/ DataProviderEntity.php, line 1304 - Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderEntity.
Class
- DataProviderEntity
- Class DataProviderEntity.
Namespace
Drupal\restful\Plugin\resource\DataProviderCode
protected function getFieldsFromPublicNameItem(ResourceFieldResourceInterface $resource_field) {
$property = $resource_field
->getProperty();
$item = array(
'name' => $property,
'type' => ResourceFieldEntity::propertyIsField($property) ? RelationalFilterInterface::TYPE_FIELD : RelationalFilterInterface::TYPE_PROPERTY,
'entity_type' => NULL,
'bundles' => array(),
'target_column' => $resource_field
->getTargetColumn(),
);
$item['column'] = $item['type'] == RelationalFilterInterface::TYPE_FIELD ? $resource_field
->getColumn() : NULL;
/* @var ResourceEntity $resource */
$resource = $resource_field
->getResourcePlugin();
// Variables for the next iteration.
$definitions = $resource
->getFieldDefinitions();
$item['entity_type'] = $resource
->getEntityType();
$item['bundles'] = $resource
->getBundles();
return array(
$item,
$definitions,
);
}