Permalink
Browse files

Some improvements to streamline extras CMP development

  • Loading branch information...
1 parent 1bfaa11 commit c8b80df56f8190ad94131e44e7cfad3d03967223 Shaun McCormick committed Apr 16, 2012
@@ -855,6 +855,8 @@ public function addLexiconTopic($topic) {
* Utility abstract class for usage by Extras that has a subrequest handler that does auto-routing by the &action
* REQUEST parameter. You must extend this class in your Extra to use it.
*
+ * @deprecated Not really needed in 2.3 due to new pathing of controllers. Will be removed in 2.4/3.0.
+ *
* @abstract
* @package modx
*/
@@ -105,6 +105,9 @@ public function outputContent(array $options = array()) {
$paths = $this->getNamespacePath($theme);
$f = $this->action['controller'];
$className = $this->getControllerClassName();
+ if (!class_exists($className) && $this->namespace != 'core') {
+ $className = ucfirst($this->namespace).$className;
+ }
if (!class_exists($className)) {
$classFile = strtolower($f).'.class.php';
$classPath = null;
@@ -338,7 +341,13 @@ public function getNamespacePath($theme = 'default') {
$namespace = array_key_exists($this->namespace,$this->namespaces) ? $this->namespaces[$this->namespace] : $this->namespaces['core'];
/* find context path */
if (isset($namespace['name']) && $namespace['name'] != 'core') {
- /* if a custom 3rd party path */
+ $paths[] = $namespace['path'].'controllers/'.trim($theme,'/').'/';
+ if ($theme != 'default') {
+ $paths[] = $namespace['path'].'controllers/default/';
+ }
+ $paths[] = $namespace['path'].'controllers/';
+
+ /* deprecated old usage */
$paths[] = $namespace['path'].trim($theme,'/');
if ($theme != 'default') {
$paths[] = $namespace['path'].'default/';
@@ -32,6 +32,9 @@
foreach ($exploded as $permission) $permissions[trim($permission)]= true;
if (!empty($permissions) && !$modx->hasPermission($permissions)) continue;
}
+ if ($menu['namespace'] != 'core') {
+ $menu['action'] .= '&namespace='.$menu['namespace'];
+ }
$menuTpl = '<li id="limenu-'.$menu['text'].'" class="top'.'">'."\n";
if (!empty($menu['handler'])) {
@@ -65,6 +68,10 @@ function _modProcessMenus(modX &$modx,&$output,$menus,&$childrenCt,$showDescript
}
$smTpl = '<li>'."\n";
+ if ($menu['namespace'] != 'core') {
+ $menu['action'] .= '&namespace='.$menu['namespace'];
+ }
+
$description = !empty($menu['description']) ? '<span class="description">'.$menu['description'].'</span>'."\n" : '';
if (!empty($menu['handler'])) {

0 comments on commit c8b80df

Please sign in to comment.