public function EntityDefaultExtraFieldsController::fieldExtraFields in Entity API 7
Implements EntityExtraFieldsControllerInterface::fieldExtraFields().
Overrides EntityExtraFieldsControllerInterface::fieldExtraFields
File
- ./
entity.info.inc, line 235 - Provides basic entity property info for entities provided via the CRUD API, as well as property info for all entity types defined by core. For that the respective modules/MODULE.info.inc files are included.
Class
- EntityDefaultExtraFieldsController
- Default controller for generating extra fields based on property metadata.
Code
public function fieldExtraFields() {
$extra = array();
foreach ($this->propertyInfo['properties'] as $name => $property_info) {
// Skip adding the ID or bundle.
if ($this->entityInfo['entity keys']['id'] == $name || $this->entityInfo['entity keys']['bundle'] == $name) {
continue;
}
$extra[$this->entityType][$this->entityType]['display'][$name] = $this
->generateExtraFieldInfo($name, $property_info);
}
// Handle bundle properties.
$this->propertyInfo += array(
'bundles' => array(),
);
foreach ($this->propertyInfo['bundles'] as $bundle_name => $info) {
foreach ($info['properties'] as $name => $property_info) {
if (empty($property_info['field'])) {
$extra[$this->entityType][$bundle_name]['display'][$name] = $this
->generateExtraFieldInfo($name, $property_info);
}
}
}
return $extra;
}