function path_entity_type_alter

Same name in other branches
  1. 9 core/modules/path/path.module \path_entity_type_alter()
  2. 8.9.x core/modules/path/path.module \path_entity_type_alter()
  3. 11.x core/modules/path/path.module \path_entity_type_alter()

Implements hook_entity_type_alter().

File

core/modules/path/path.module, line 49

Code

function path_entity_type_alter(array &$entity_types) {
    // @todo Remove the conditional once core fully supports "path_alias" as an
    //   optional module. See https://drupal.org/node/3092090.
    
    /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
    if (isset($entity_types['path_alias'])) {
        $entity_types['path_alias']->setFormClass('default', PathAliasForm::class);
        $entity_types['path_alias']->setFormClass('delete', ContentEntityDeleteForm::class);
        $entity_types['path_alias']->setHandlerClass('route_provider', [
            'html' => AdminHtmlRouteProvider::class,
        ]);
        $entity_types['path_alias']->setListBuilderClass(PathAliasListBuilder::class);
        $entity_types['path_alias']->setLinkTemplate('collection', '/admin/config/search/path');
        $entity_types['path_alias']->setLinkTemplate('add-form', '/admin/config/search/path/add');
        $entity_types['path_alias']->setLinkTemplate('edit-form', '/admin/config/search/path/edit/{path_alias}');
        $entity_types['path_alias']->setLinkTemplate('delete-form', '/admin/config/search/path/delete/{path_alias}');
    }
}

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