function ds_entity_type_alter in Display Suite 8.3
Same name and namespace in other branches
- 8.4 ds.module \ds_entity_type_alter()
- 8.2 ds.module \ds_entity_type_alter()
Implements hook_entity_type_alter().
File
- ./
ds.module, line 1159 - Display Suite core functions.
Code
function ds_entity_type_alter(array &$entity_types) {
if (\Drupal::moduleHandler()
->moduleExists('field_ui')) {
/* @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
foreach ($entity_types as $entity_type) {
$base_table = $entity_type
->getBaseTable();
if ($entity_type
->get('field_ui_base_route') && !empty($base_table)) {
if ($entity_type
->hasLinkTemplate('canonical')) {
$entity_type
->setLinkTemplate('display', $entity_type
->getLinkTemplate('canonical') . '/manage-display');
}
}
}
}
// Undo field_layout changes to EntityViewDisplay.
if (\Drupal::moduleHandler()
->moduleExists('field_layout') && !\Drupal::moduleHandler()
->moduleExists('layout_builder')) {
$entity_types['entity_view_display']
->setClass($entity_types['entity_view_display']
->getOriginalClass());
if (\Drupal::moduleHandler()
->moduleExists('field_ui')) {
$entity_types['entity_view_display']
->setFormClass('edit', 'Drupal\\field_ui\\Form\\EntityViewDisplayEditForm');
}
}
}