/** * Add a callback to an event queue, after a given event. * * @param string name * @param array existing * @param array callback * @return boolean */ public static function add_after($name, array $existing, array $callback) { if (empty(Event::$_events[$name]) or FALSE === ($key = array_search($existing, Event::$_events[$name], TRUE))) { // No need to insert, just add return Event::add($name, $callback); } // Insert the event immediately after the existing event return Event::_insert_event($name, $key++, $callback); }