You are here

public static function OverrideHelper::entityForm in Varbase Media 8.7

Same name and namespace in other branches
  1. 8.5 modules/entity_browser_generic_embed/src/OverrideHelper.php \Drupal\entity_browser_generic_embed\OverrideHelper::entityForm()
  2. 8.6 modules/entity_browser_generic_embed/src/OverrideHelper.php \Drupal\entity_browser_generic_embed\OverrideHelper::entityForm()
  3. 9.0.x modules/entity_browser_generic_embed/src/OverrideHelper.php \Drupal\entity_browser_generic_embed\OverrideHelper::entityForm()

Overrides the class used for an entity form.

The replacement class is only used if its immediate parent is the form class used for the specified operation.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.

string $replacement_class: The class to use.

string $operation: (optional) The entity operation.

File

modules/entity_browser_generic_embed/src/OverrideHelper.php, line 59

Class

OverrideHelper
Helps tweak and override implementations of various things.

Namespace

Drupal\entity_browser_generic_embed

Code

public static function entityForm(EntityTypeInterface $entity_type, $replacement_class, $operation = 'default') {
  if (get_parent_class($replacement_class) == $entity_type
    ->getFormClass($operation)) {
    $entity_type
      ->setFormClass($operation, $replacement_class);
  }
}