You are here

function search_api_solr_entity_type_alter in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 search_api_solr.module \search_api_solr_entity_type_alter()
  2. 4.x search_api_solr.module \search_api_solr_entity_type_alter()

Implements hook_entity_type_alter().

File

./search_api_solr.module, line 111
Provides a Solr-based service class for the Search API.

Code

function search_api_solr_entity_type_alter(array &$entity_types) {
  if (\Drupal::moduleHandler()
    ->moduleExists('devel')) {

    /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
    foreach ($entity_types as $entity_type_id => $entity_type) {
      if ($entity_type
        ->hasViewBuilderClass() && $entity_type
        ->hasLinkTemplate('canonical')) {
        $entity_type
          ->setLinkTemplate('devel-solr', "/devel/{$entity_type_id}/{{$entity_type_id}}/solr");
      }
    }
  }
}