/**
* Sets the default route according to the configuration data provided in $config.
* Two settings are required: the route prefix (key: routePrefix),
* and the controller class-name (key: controllerClass).
*
* Three optional settings are supported as well: major section (key: majorSection),
* minor section (key: minorSection) and request parameters (key: params);
* which might be used during the routing process.
*
* @param Zend_Config $config Configuration data
* @param array $dependencyData Data array supplied by the "init_dependencies" event
* @throws XenForo_Exception
*/
public static function setDefaultRoute(Zend_Config $config, array $dependencyData)
{
$routesPublic = $dependencyData['routesPublic'];
if (!$config->routePrefix || !$config->controllerClass) {
// Debugging message. No need for phrasing.
throw new XenForo_Exception('Missing route-prefix and/or controller class-name.');
}
if ($config->readOnly()) {
// A read-only object was passed. Arghh!
$newConfig = new Zend_Config(array('routeClass' => $routesPublic[$config->routePrefix]['route_class']), true);
$config = $newConfig->merge($config);
} else {
$config->routeClass = $routesPublic[$config->routePrefix]['route_class'];
}
self::_setCustomRoutePrefixes($config->routePrefix, $routesPublic);
$config->setReadOnly();
XenForo_Application::set('customIndex', $config);
}