* @return $factoryInstance An instance of a WebNewsFactory class
*/
public final static function createFactoryByRequest (Requestable $requestInstance) {
+ // Set default news reader class
+ $configEntry = "news_reader_class";
+
+ // Get "page"
+ $page = $requestInstance->getRequestElement('page');
+
+ // Is "page" used?
+ if (!empty($page)) {
+ // Then add it
+ $configEntry = sprintf("news_reader_%s_class", $page);
+
+ // Get "action"
+ $action = $requestInstance->getRequestElement('action');
+
+ // Is it also there?
+ if (!empty($action)) {
+ // Then use both for config entry
+ $configEntry = sprintf("news_reader_%s_%s_class", $page, $action);
+ } // END - if
+ } // END - if
+
// Get the news reader class name from config
- $className = $requestInstance->getConfigInstance()->readConfig('news_reader_class');
+ $className = $requestInstance->getConfigInstance()->readConfig($configEntry);
// Once we have that name, try to load initialize it
$newsInstance = ObjectFactory::createObjectByName($className, array($requestInstance));