You are here

class ClusterRouteProvider in Elasticsearch Connector 8.5

Same name and namespace in other branches
  1. 8.7 src/Entity/ClusterRouteProvider.php \Drupal\elasticsearch_connector\Entity\ClusterRouteProvider
  2. 8.2 src/Entity/ClusterRouteProvider.php \Drupal\elasticsearch_connector\Entity\ClusterRouteProvider
  3. 8.6 src/Entity/ClusterRouteProvider.php \Drupal\elasticsearch_connector\Entity\ClusterRouteProvider

Provides routes for elasticsearch clusters.

Hierarchy

Expanded class hierarchy of ClusterRouteProvider

1 file declares its use of ClusterRouteProvider
ClusterRouteProviderTest.php in tests/src/Unit/Entity/ClusterRouteProviderTest.php

File

src/Entity/ClusterRouteProvider.php, line 13

Namespace

Drupal\elasticsearch_connector\Entity
View source
class ClusterRouteProvider implements EntityRouteProviderInterface {

  /**
   * {@inheritdoc}
   */
  public function getRoutes(EntityTypeInterface $entity_type) {
    $route_collection = new RouteCollection();

    // TODO: Permissions should be checked and implemented.
    $route = (new Route('/admin/config/search/elasticsearch-connector/cluster/{elasticsearch_cluster}'))
      ->addDefaults([
      '_controller' => '\\Drupal\\elasticsearch_connector\\Controller\\ElasticsearchController::getInfo',
      '_title_callback' => '\\Drupal\\elasticsearch_connector\\Controller\\ElasticsearchController::pageTitle',
      '_title' => 'Cluster Info',
    ])
      ->setRequirement('_entity_access', 'elasticsearch_cluster.view')
      ->setOptions([
      'parameters' => [
        'elasticsearch_cluster' => [
          'with_config_overrides' => TRUE,
        ],
      ],
    ]);
    $route_collection
      ->add('entity.elasticsearch_cluster.canonical', $route);
    $route = (new Route('/admin/config/search/elasticsearch-connector/cluster/{elasticsearch_cluster}/delete'))
      ->addDefaults([
      '_entity_form' => 'elasticsearch_cluster.delete',
      '_title' => 'Delete cluster',
    ])
      ->setRequirement('_entity_access', 'elasticsearch_cluster.delete');
    $route_collection
      ->add('entity.elasticsearch_cluster.delete_form', $route);
    $route = (new Route('/admin/config/search/elasticsearch-connector/cluster/{elasticsearch_cluster}/edit'))
      ->addDefaults([
      '_entity_form' => 'elasticsearch_cluster.default',
      '_title_callback' => '\\Drupal\\elasticsearch_connector\\Controller\\ElasticsearchController::pageTitle',
      '_title' => 'Edit cluster',
    ])
      ->setRequirement('_entity_access', 'elasticsearch_cluster.update');
    $route_collection
      ->add('entity.elasticsearch_cluster.edit_form', $route);
    $route = (new Route('/admin/config/search/elasticsearch-connector/cluster/add'))
      ->addDefaults([
      '_entity_form' => 'elasticsearch_cluster.default',
      '_title' => 'Add cluster',
    ])
      ->setRequirement('_entity_create_access', 'elasticsearch_cluster');
    $route_collection
      ->add('entity.elasticsearch_cluster.add_form', $route);
    return $route_collection;
  }

}

Members