You are here

class EventSubscriber in Fast Autocomplete 8

Class EventSubscriber.

Subscribes to the alter_excluded_paths event from the stage_file_proxy module to exclude the path for the json files of the fac module.

@package Drupal\fac\EventSubscriber

Hierarchy

  • class \Drupal\fac\EventSubscriber\EventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of EventSubscriber

1 string reference to 'EventSubscriber'
fac.services.yml in ./fac.services.yml
fac.services.yml
1 service uses EventSubscriber
fac.event_subscriber in ./fac.services.yml
Drupal\fac\EventSubscriber\EventSubscriber

File

src/EventSubscriber/EventSubscriber.php, line 17

Namespace

Drupal\fac\EventSubscriber
View source
class EventSubscriber implements EventSubscriberInterface {

  /**
   * Register events and callbacks.
   *
   * @return array
   *   The array of registered events with callbacks.
   */
  public static function getSubscribedEvents() {
    $events['stage_file_proxy.alter_excluded_paths'][] = [
      'alterExcludedPaths',
      0,
    ];
    return $events;
  }

  /**
   * The excluded paths event callback.
   *
   * @param object $event
   *   The event.
   */
  public function alterExcludedPaths($event) {
    $excluded_paths = $event
      ->getExcludedPaths();
    $excluded_paths[] = PublicStream::basePath() . '/fac-json';
    $event
      ->setExcludedPaths($excluded_paths);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EventSubscriber::alterExcludedPaths public function The excluded paths event callback.
EventSubscriber::getSubscribedEvents public static function Register events and callbacks.