EntityTypeManager::processDefinition

public EntityTypeManager::processDefinition(&$definition, $plugin_id)

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

File

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

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'");
    }
  }
}
doc_Drupal
2016-10-29 09:08:36
Comments
Leave a Comment

Please login to continue.