function drush_devel_fn_event

Command handler. Show hook implementations.

File

drush/devel.drush8.inc, line 142

Code

function drush_devel_fn_event($event = NULL) {
    $dispatcher = Drupal::service('event_dispatcher');
    if (empty($event)) {
        $events = array(
            'kernel.controller',
            'kernel.exception',
            'kernel.request',
            'kernel.response',
            'kernel.terminate',
            'kernel.view',
        );
        $events = array_combine($events, $events);
        if (!($event = drush_choice($events, 'Enter the event you wish to explore.'))) {
            return drush_user_abort();
        }
    }
    if ($implementations = $dispatcher->getListeners($event)) {
        foreach ($implementations as $implementation) {
            $callable = get_class($implementation[0]) . '::' . $implementation[1];
            $choices[$callable] = $callable;
        }
        if ($choice = drush_choice($choices, 'Enter the number of the implementation you wish to view.')) {
            return drush_devel_fn_view($choice);
        }
    }
    else {
        drush_log(dt('No implementations.'), 'ok');
    }
}