You are here

public function AssetInlineEntityFormController::tableFields in Asset 7

Returns an array of fields used to represent an entity in the IEF table.

The fields can be either Field API fields or properties defined through hook_entity_property_info().

Modules can alter the output of this method through hook_inline_entity_form_table_fields_alter().

Parameters

$bundles: An array of allowed bundles for this widget.

Return value

An array of field information, keyed by field name. Allowed keys:

  • type: 'field' or 'property',
  • label: Human readable name of the field, shown to the user.
  • weight: The position of the field relative to other fields.

Special keys for type 'field', all optional:

  • formatter: The formatter used to display the field, or "hidden".
  • settings: An array passed to the formatter. If empty, defaults are used.
  • delta: If provided, limits the field to just the specified delta.

Overrides EntityInlineEntityFormController::tableFields

File

includes/asset.inline_entity_form.inc, line 35
Defines the asset inline entity form controller.

Class

AssetInlineEntityFormController
@file Defines the asset inline entity form controller.

Code

public function tableFields($bundles) {
  $fields = parent::tableFields($bundles);
  $info = entity_get_info($this->entityType);
  $metadata = entity_get_property_info($this->entityType);
  $type_key = $info['entity keys']['bundle'];
  $fields[$type_key] = array(
    'type' => 'property',
    'label' => $metadata ? $metadata['properties'][$type_key]['label'] : t('Asset Type'),
    'weight' => 2,
  );
  return $fields;
}