function EntityTypeInfo::entityTypeAlter
Same name in other branches
- 8.x-1.x src/EntityTypeInfo.php \Drupal\devel\EntityTypeInfo::entityTypeAlter()
- 5.x src/EntityTypeInfo.php \Drupal\devel\EntityTypeInfo::entityTypeAlter()
Adds devel links to appropriate entity types.
This is an alter hook bridge.
Parameters
\Drupal\Core\Entity\EntityTypeInterface[] $entity_types: The master entity type list to alter.
See also
File
-
src/
EntityTypeInfo.php, line 58
Class
- EntityTypeInfo
- Manipulates entity type information.
Namespace
Drupal\develCode
public function entityTypeAlter(array &$entity_types) {
foreach ($entity_types as $entity_type_id => $entity_type) {
if (($entity_type->getFormClass('default') || $entity_type->getFormClass('edit')) && $entity_type->hasLinkTemplate('edit-form')) {
// We use edit-form template to extract and set additional parameters
// dynamically.
$entity_link = $entity_type->getLinkTemplate('edit-form');
$this->setEntityTypeLinkTemplate($entity_type, $entity_link, 'devel-load', "/devel/{$entity_type_id}", $entity_link);
}
if ($entity_type->hasViewBuilderClass() && $entity_type->hasLinkTemplate('canonical')) {
// We use canonical template to extract and set additional parameters
// dynamically.
$entity_link = $entity_type->getLinkTemplate('canonical');
$this->setEntityTypeLinkTemplate($entity_type, $entity_link, 'devel-render', "/devel/render/{$entity_type_id}", 'canonical');
}
if ($entity_type->hasLinkTemplate('devel-render') || $entity_type->hasLinkTemplate('devel-load')) {
// We use canonical or edit-form template to extract and set additional
// parameters dynamically.
$entity_link = $entity_type->getLinkTemplate('edit-form');
if (empty($entity_link)) {
$entity_link = $entity_type->getLinkTemplate('canonical');
}
$this->setEntityTypeLinkTemplate($entity_type, $entity_link, 'devel-definition', "/devel/definition/{$entity_type_id}");
}
}
}