You are here

class ViewsPerformanceAnalyzerSubscriber in Entity Pager 8

Same name and namespace in other branches
  1. 2.0.x src/EventSubscriber/ViewsPerformanceAnalyzerSubscriber.php \Drupal\entity_pager\EventSubscriber\ViewsPerformanceAnalyzerSubscriber

An event subscriber to provide performance feedback on the Entity Pager view.

Hierarchy

Expanded class hierarchy of ViewsPerformanceAnalyzerSubscriber

File

src/EventSubscriber/ViewsPerformanceAnalyzerSubscriber.php, line 12

Namespace

Drupal\entity_pager\EventSubscriber
View source
class ViewsPerformanceAnalyzerSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events = [];
    $events[EntityPagerEvents::ENTITY_PAGER_ANALYZE][] = [
      'onEntityPagerAnalyze',
    ];
    return $events;
  }

  /**
   * Analyzes the entity pager view for performance issues and provide feedback.
   *
   * @param \Drupal\entity_pager\Event\EntityPagerAnalyzeEvent $event
   *   The Entity Pager Analyze event.
   */
  public function onEntityPagerAnalyze(EntityPagerAnalyzeEvent $event) {
    $options = $event
      ->getEntityPager()
      ->getOptions();
    if (!$options['log_performance']) {
      return;
    }

    // @todo Log performance issues about the view
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ViewsPerformanceAnalyzerSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
ViewsPerformanceAnalyzerSubscriber::onEntityPagerAnalyze public function Analyzes the entity pager view for performance issues and provide feedback.