file_encrypt-8.x-1.x-dev/src/Routing/RouteSubscriber.php

src/Routing/RouteSubscriber.php
<?php

namespace Drupal\file_encrypt\Routing;

use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Modify file_encrypt routes to support redirect.
 */
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * The module handler service.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected $moduleHandler;

  /**
   * Constructs a new RouteSubscriber object.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler service.
   */
  public function __construct(ModuleHandlerInterface $module_handler) {
    $this->moduleHandler = $module_handler;
  }

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($this->moduleHandler->moduleExists('redirect') && $route = $collection->get('file_encrypt.file_download')) {
      $route->setDefault('_disable_route_normalizer', TRUE);
    }
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc