You are here

class RouteSubscriber in Paragraphs frontend ui 8.2

Class RouteSubscriber.

Listens to the dynamic route events.

Hierarchy

  • class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber'
paragraphs_frontend_ui.services.yml in ./paragraphs_frontend_ui.services.yml
paragraphs_frontend_ui.services.yml
1 service uses RouteSubscriber
paragraphs_frontend_ui.route_subscriber in ./paragraphs_frontend_ui.services.yml
Drupal\paragraphs_frontend_ui\Routing\RouteSubscriber

File

src/Routing/RouteSubscriber.php, line 14

Namespace

Drupal\paragraphs_frontend_ui\Routing
View source
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection
      ->get('paragraphs_edit.edit_form')) {
      $config = \Drupal::config(SettingsForm::SETTINGS_NAME);
      $route
        ->addDefaults([
        '_entity_form' => $config
          ->get('pfui_edit_content_form_mode'),
      ]);
      $route
        ->addRequirements([
        '_custom_access' => '\\Drupal\\paragraphs_frontend_ui\\Controller\\ParagraphsFrontendUIController::accessEditContent',
      ]);
    }
    if ($route = $collection
      ->get('paragraphs_edit.delete_form')) {
      $route
        ->addRequirements([
        '_custom_access' => '\\Drupal\\paragraphs_frontend_ui\\Controller\\ParagraphsFrontendUIController::accessLibraryItem',
      ]);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1