/** * Handle a request. * * The URL of the component that is used to handle the request is obtained automatically. * If the handler hook returns false (i.e. handling failed), it will produce an error page. * * @param midcom_baseclasses_components_interface $handler The component's main handler class */ public function run(midcom_baseclasses_components_interface $handler) { $result = $handler->handle(); if (false === $result) { throw new midcom_error("Component " . $this->get_key(MIDCOM_CONTEXT_COMPONENT) . " failed to handle the request"); } else { if (is_object($result) && $result instanceof midcom_response) { $result->send(); //this will exit } } // Retrieve Metadata $nav = new midcom_helper_nav(); if ($nav->get_current_leaf() === false) { $meta = $nav->get_node($nav->get_current_node()); } else { $meta = $nav->get_leaf($nav->get_current_leaf()); } if ($this->get_key(MIDCOM_CONTEXT_PERMALINKGUID) === null) { $this->set_key(MIDCOM_CONTEXT_PERMALINKGUID, $meta[MIDCOM_NAV_GUID]); } if ($this->get_key(MIDCOM_CONTEXT_PAGETITLE) == '') { $this->set_key(MIDCOM_CONTEXT_PAGETITLE, $meta[MIDCOM_NAV_NAME]); } }