Attach listener.

@param EventManagerInterface $events
552547
public function attach(EventManagerInterface $events)
    {
        $this->listeners[] = $events->attach(
            ComposerEvent::EVENT_HEADERS_POST,
            array($this, 'injectOverrideHeaders'),
            -100 // The priority needs to be lower than the other plugins
        );
    }
573996
public function attach(EventManagerInterface $events, $priority = 1)
    {
        $events->attach(PageEvent::EVENT_ADD_PRE, [$this, 'setStandardParams']);
        $events->attach(PageEvent::EVENT_EDIT_PRE, [$this, 'setStandardParams']);
        $events->attach(PageEvent::EVENT_APPROVED, [$this, 'setStandardParams']);

        $events->attach(PageEvent::EVENT_ADD_PRE, [$this, 'setSlug']);
        $events->attach(PageEvent::EVENT_EDIT_PRE, [$this, 'setSlug']);
        $events->attach(PageEvent::EVENT_APPROVED, [$this, 'setSlug']);

        $events->attach(PageEvent::EVENT_APPROVED, [$this, 'saveNavigation']);

        $events->attach(PageEvent::EVENT_APPROVED, [$this, 'updateCache']);
    }
1259105
protected function makeEventAndListeners($event, $listeners)
    {
        if (! Str::contains($event, '\\')) {
            return;
        }

        $this->callSilent('make:event', ['name' => $event]);

        $this->makeListeners($event, $listeners);
    }
1374475
private function registerEvents()
    {
        foreach ($this->getSetting('events', []) as $event => $listeners) {
            foreach ($listeners as $listener) {
                Event::bind($event, $listener);
            }
        }
    }
628696
protected function makeEventAndListeners($event, $listeners)
    {
        if (! Str::contains($event, '\\')) {
            return;
        }

        $this->call('generate:event', ['name' => $event]);

        $this->makeListeners($event, $listeners);
    }
35072
public function attach(ActionEventDispatcher $events)
    {
        $this->trackHandler($events->attachListener(MessageDispatch::INITIALIZE, [$this, 'onInitializeMessageDispatch']));
        $this->trackHandler($events->attachListener(MessageDispatch::FINALIZE, [$this, 'onFinalizeMessageDispatch']));
    }
1151188
public function attachEvents($events=array()) {
		if (\is_array($events)) {
			foreach ( $events as $action => $selector ) {
				$this->attachEvent($selector, $action);
			}
		}
		return $this;
	}
1149241
public function attach(EventManagerInterface $events)
    {
        $this->listeners[] = $events->attach(
            ViewEvent::EVENT_RENDERER_POST
            , array($this, 'onRenderRenderWidgets')
        );
    }
113083
public function setEventManager(EventManagerInterface $events)
    {
        $events->setIdentifiers(array(
            __CLASS__,
            get_class($this)
        ));
        $events->setSharedManager(
            $this->getContainer()->get("sharedEventManager")
        );
        $this->_events = $events;
        return $this;
    }
830402
public function listen($events, $listener)
    {
        foreach ((array) $events as $event) {
            if (Str::contains($event, '*')) {
                $this->setupWildcardListen($event, $listener);
            } else {
                $this->listeners[$event][] = $this->makeListener($listener);
            }
        }
    }
864685
private function registerEventListeners()
    {
        $listeners = $this->getListeners();
        foreach ($listeners as $listenerKey => $listenerValues) {
            foreach ($listenerValues as $listenerValue) {
                \Event::listen($listenerKey,
                    $listenerValue
                );
            }
        }
    }
299221
public function addListener(ListenerInterface $listener)
    {
        if (!in_array($listener, $this->collection_listeners, true)) {
            $this->collection_listeners[] = $listener;
        }
    }
150371
public function setEventListeners($listeners)
	{
		$this->ensureEventListeners();
		
		foreach ($listeners as $listener) {
			$this->_eventListeners[Ioc::resolveClassName($listener)] = $listener;
		}
		
		return $this;
	}
807271
public function attach(EventManagerInterface $events, $priority = PHP_INT_MAX)
    {
        $this->listeners[] = $events->attach(
            Application::EVENT_PRE_BOOTSTRAP,
            [
                $this,
                'onBootstrapLoadConfig'
            ],
            $priority - 1
        );
    }
62958
public function attach(EventManagerInterface $events)
    {
        $this->listeners[] = $events->attach(MvcEvent::EVENT_FINISH, array($this, 'onFinish'));
    }
1001697
public function subscribe(EventInterface $event) {
        $resources = Resource::getAllResources();

        if ($this->params['additionalResources']) {
            $resources = array_merge($resources, $this->params['additionalResources']);
        }

        $events = [];
        foreach ($resources as $resource) {
            $events[$resource] = ['checkAccess' => 500];
        }

        $manager = $event->getManager();
        $manager->addCallbacks($event->getHandler(), $events);
    }
94596
protected function registerEventListeners()
    {
        foreach ($this->events as $event => $listener) {
            Event::listen($event, $listener);
        }

        return $this;
    }