You are here

function hook_inline_entity_form_table_fields_alter in Inline Entity Form 8

Same name and namespace in other branches
  1. 7 inline_entity_form.api.php \hook_inline_entity_form_table_fields_alter()

Alter the fields used to represent an entity in the IEF table.

Parameters

array $fields: The fields, keyed by field name.

array $context: An array with the following keys:

  • parent_entity_type: The type of the parent entity.
  • parent_bundle: The bundle of the parent entity.
  • field_name: The name of the reference field on which IEF is operating.
  • entity_type: The type of the referenced entities.
  • allowed_bundles: Bundles allowed on the reference field.

See also

\Drupal\inline_entity_form\InlineFormInterface::getTableFields()

1 invocation of hook_inline_entity_form_table_fields_alter()
InlineEntityFormComplex::formElement in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Returns the form for a single field widget.

File

./inline_entity_form.api.php, line 52
Hooks provided by the Inline Entity Form module.

Code

function hook_inline_entity_form_table_fields_alter(array &$fields, array $context) {
  if ($context['entity_type'] == 'commerce_product_variation') {
    $fields['field_category'] = [
      'type' => 'field',
      'label' => t('Category'),
      'weight' => 101,
    ];
  }
}