Pathologic was missing because of a .git folder inside.
[yaffs-website] / web / modules / contrib / inline_entity_form / inline_entity_form.api.php
1 <?php
2
3 /**
4  * @file
5  * Hooks provided by the Inline Entity Form module.
6  */
7
8 /**
9  * Perform alterations before an entity form is included in the IEF widget.
10  *
11  * @param $entity_form
12  *   Nested array of form elements that comprise the entity form.
13  * @param $form_state
14  *   The form state of the parent form.
15  */
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.');
19   }
20 }
21
22 /**
23  * Perform alterations before the reference form is included in the IEF widget.
24  *
25  * The reference form is used to add existing entities through an autocomplete
26  * field
27  *
28  * @param $reference_form
29  *   Nested array of form elements that comprise the reference form.
30  * @param $form_state
31  *   The form state of the parent form.
32  */
33 function hook_inline_entity_form_reference_form_alter(&$reference_form, &$form_state) {
34   $reference_form['entity_id']['#description'] = t('New autocomplete description');
35 }
36
37 /**
38  * Alter the fields used to represent an entity in the IEF table.
39  *
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.
49  *
50  * @see \Drupal\inline_entity_form\InlineFormInterface::getTableFields()
51  */
52 function hook_inline_entity_form_table_fields_alter(&$fields, $context) {
53   if ($context['entity_type'] == 'commerce_product_variation') {
54     $fields['field_category'] = [
55       'type' => 'field',
56       'label' => t('Category'),
57       'weight' => 101,
58     ];
59   }
60 }