You are here

function inline_entity_form_entity_type_build in Inline Entity Form 8

Implements hook_entity_type_build().

File

./inline_entity_form.module, line 26
Provides a widget for inline management (creation, modification, removal) of referenced entities. The primary use case is the parent -> children one (for example, order -> line items), where the child entities are never managed outside the…

Code

function inline_entity_form_entity_type_build(array &$entity_types) {

  /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
  if (isset($entity_types['node']) && !$entity_types['node']
    ->getHandlerClass('inline_form')) {
    $entity_types['node']
      ->setHandlerClass('inline_form', '\\Drupal\\inline_entity_form\\Form\\NodeInlineForm');
  }
  foreach ($entity_types as &$entity_type) {
    if (!$entity_type
      ->hasHandlerClass('inline_form')) {
      $entity_type
        ->setHandlerClass('inline_form', '\\Drupal\\inline_entity_form\\Form\\EntityInlineForm');
    }
  }
}