5 * Hooks provided by the Inline Entity Form module.
9 * Perform alterations before an entity form is included in the IEF widget.
12 * Nested array of form elements that comprise the entity form.
14 * The form state of the parent form.
16 function hook_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
17 if ($entity_form['#entity_type'] == 'commerce_line_item') {
18 $entity_form['quantity']['#description'] = t('New quantity description.');
23 * Perform alterations before the reference form is included in the IEF widget.
25 * The reference form is used to add existing entities through an autocomplete
28 * @param $reference_form
29 * Nested array of form elements that comprise the reference form.
31 * The form state of the parent form.
33 function hook_inline_entity_form_reference_form_alter(&$reference_form, &$form_state) {
34 $reference_form['entity_id']['#description'] = t('New autocomplete description');
38 * Alter the fields used to represent an entity in the IEF table.
40 * @param array $fields
41 * The fields, keyed by field name.
42 * @param array $context
43 * An array with the following keys:
44 * - parent_entity_type: The type of the parent entity.
45 * - parent_bundle: The bundle of the parent entity.
46 * - field_name: The name of the reference field on which IEF is operating.
47 * - entity_type: The type of the referenced entities.
48 * - allowed_bundles: Bundles allowed on the reference field.
50 * @see \Drupal\inline_entity_form\InlineFormInterface::getTableFields()
52 function hook_inline_entity_form_table_fields_alter(&$fields, $context) {
53 if ($context['entity_type'] == 'commerce_product_variation') {
54 $fields['field_category'] = [
56 'label' => t('Category'),