public function 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 82

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'");
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityTypeManager.php/function/EntityTypeManager::processDefinition/8.1.x