public function loadEvent($name)
    {
        // 1. Load event data only once
        if (isset($this->loadedEvents[$name])) {
            return;
        }
        $this->loadedEvents[$name] = true;

        // 2. Get event handlers
        $events = $this->getEvents();
        if (!isset($events[$name])) {
            return;
        }

        // 3. Attach handlers to event
        $baseMethod = 'on' . ucfirst($name);
        foreach ($events[$name] as $priority => $pluginIds) {
            if ($priority && $priority != static::DEFAULT_PRIORITY) {
                $method = $baseMethod . $priority;
            } else {
                $method = $baseMethod;
            }

            foreach ($pluginIds as $pluginId) {
                $plugin = $this->getById($pluginId);
                if (method_exists($plugin, $method)) {
                    $this->event->on($name, [$plugin, $method], $priority);
                }
            }
        }
    }
public function loadEvent($name)
    {
        // 1. Load event data only once
        if (isset($this->loadedEvents[$name])) {
            return;
        }
        $this->loadedEvents[$name] = true;

        // 2. Get event handlers
        $events = $this->getEvents();
        if (!isset($events[$name])) {
            return;
        }

        // 3. Attach handlers to event
        $baseMethod = 'on' . ucfirst($name);
        foreach ($events[$name] as $priority => $pluginIds) {
            if ($priority && $priority != static::DEFAULT_PRIORITY) {
                $method = $baseMethod . $priority;
            } else {
                $method = $baseMethod;
            }

            foreach ($pluginIds as $pluginId) {
                $plugin = $this->getById($pluginId);
                if (method_exists($plugin, $method)) {
                    $this->event->on($name, [$plugin, $method], $priority);
                }
            }
        }
    }
public function loadEvent ( $ name ) { // 1. Load event data only once if ( isset ( $ this -> loadedEvents [ $ name ] ) ) { return ; } $ this -> loadedEvents [ $ name ] = true ; // 2. Get event handlers $ events = $ this -> getEvents ( ) ; if ( ! isset ( $ events [ $ name ] ) ) { return ; } // 3. Attach handlers to event $ baseMethod = 'on' . ucfirst ( $ name ) ; foreach ( $ events [ $ name ] as $ priority => $ pluginIds ) { if ( $ priority && $ priority != static :: DEFAULT_PRIORITY ) { $ method = $ baseMethod . $ priority ; } else { $ method = $ baseMethod ; } foreach ( $ pluginIds as $ pluginId ) { $ plugin = $ this -> getById ( $ pluginId ) ; if ( method_exists ( $ plugin , $ method ) ) { $ this -> event -> on ( $ name , [ $ plugin , $ method ] , $ priority ) ; } } } }
Load plugin event by name

@param string $name
Load plugin event by name