You are here

public function EntityTypeManager::processDefinition in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityTypeManager.php \Drupal\Core\Entity\EntityTypeManager::processDefinition()

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.

Overrides DefaultPluginManager::processDefinition

1 call to EntityTypeManager::processDefinition()
EntityTypeManager::findDefinitions in core/lib/Drupal/Core/Entity/EntityTypeManager.php
Finds plugin definitions.

File

core/lib/Drupal/Core/Entity/EntityTypeManager.php, line 100

Class

EntityTypeManager
Manages entity type plugin definitions.

Namespace

Drupal\Core\Entity

Code

public function processDefinition(&$definition, $plugin_id) {

  /** @var \Drupal\Core\Entity\EntityTypeInterface $definition */
  parent::processDefinition($definition, $plugin_id);

  // All link templates must have a leading slash.
  foreach ((array) $definition
    ->getLinkTemplates() as $link_relation_name => $link_template) {
    if ($link_template[0] != '/') {
      throw new InvalidLinkTemplateException("Link template '{$link_relation_name}' for entity type '{$plugin_id}' must start with a leading slash, the current link template is '{$link_template}'");
    }
  }
}