function media_entity_type_alter

Same name in other branches
  1. 8.9.x core/modules/media/media.module \media_entity_type_alter()
  2. 10 core/modules/media/media.module \media_entity_type_alter()
  3. 11.x core/modules/media/media.module \media_entity_type_alter()

Implements hook_entity_type_alter().

File

core/modules/media/media.module, line 364

Code

function media_entity_type_alter(array &$entity_types) {
    if (\Drupal::config('media.settings')->get('standalone_url')) {
        
        /** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */
        $entity_type = $entity_types['media'];
        $entity_type->setLinkTemplate('canonical', '/media/{media}');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.