You are here

public static function InlineEntityForm::getInlineFormHandler in Inline Entity Form 8

Gets the inline form handler for the given entity type.

Parameters

string $entity_type: The entity type id.

Return value

\Drupal\inline_entity_form\InlineFormInterface The inline form handler.

Throws

\InvalidArgumentException Thrown when the entity type has no inline form handler defined.

4 calls to InlineEntityForm::getInlineFormHandler()
InlineEntityForm::processEntityForm in src/Element/InlineEntityForm.php
Builds the entity form using the inline form handler.
InlineEntityForm::submitEntityForm in src/Element/InlineEntityForm.php
Handles the submission of the entity form using the inline form handler.
InlineEntityForm::validateEntityForm in src/Element/InlineEntityForm.php
Validates the entity form using the inline form handler.
WidgetSubmit::doSubmit in src/WidgetSubmit.php
Submits the widget elements, saving and deleted entities where needed.

File

src/Element/InlineEntityForm.php, line 198

Class

InlineEntityForm
Provides an inline entity form element.

Namespace

Drupal\inline_entity_form\Element

Code

public static function getInlineFormHandler($entity_type) {
  $inline_form_handler = \Drupal::entityTypeManager()
    ->getHandler($entity_type, 'inline_form');
  if (empty($inline_form_handler)) {
    throw new \InvalidArgumentException(sprintf('The %s entity type has no inline form handler.', $entity_type));
  }
  return $inline_form_handler;
}