You are here

function entity_reference_layout_module_implements_alter in Entity Reference with Layout 8

Implements hook_module_implements_alter().

If "content_translation", move the form_alter implementation by the entity_reference_layout at the end of the list, so that it might be called after the content_translation one. Otherwise the $form['translatable'] won't be defined in entity_reference_layout_form_field_config_edit_form_alter.

@see: https://www.hashbangcode.com/article/drupal-8-altering-hook-weights.

File

./entity_reference_layout.module, line 495
Contains entity_reference_layout.module.

Code

function entity_reference_layout_module_implements_alter(&$implementations, $hook) {

  // Move our hook_entity_type_alter() implementation to the end of the list.
  if ($hook == 'form_alter' && isset($implementations['entity_reference_layout']) && isset($implementations['content_translation'])) {
    $hook_init = $implementations['entity_reference_layout'];
    unset($implementations['entity_reference_layout']);
    $implementations['entity_reference_layout'] = $hook_init;
  }
}