You are here

public static function OverrideHelper::entityClass in Varbase Media 9.0.x

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

Overrides the entity class for an entity type.

The replacement class is only used if its immediate parent is the class specified by the entity type.

Parameters

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

string $replacement_class: The class to use.

File

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

Class

OverrideHelper
Helps tweak and override implementations of various things.

Namespace

Drupal\entity_browser_generic_embed

Code

public static function entityClass(EntityTypeInterface $entity_type, $replacement_class) {
  if (get_parent_class($replacement_class) == $entity_type
    ->getClass()) {
    $entity_type
      ->setClass($replacement_class);
  }
}