Author: Jonathan.Wage
Date: 2010-01-12 18:38:36 +0100 (Tue, 12 Jan 2010)
New Revision: 26543

Modified:
   plugins/sfSympalPlugin/trunk/config/app.yml
   
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
   
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentType.class.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/sfSympalContentActionLoader.class.php
   plugins/sfSympalPlugin/trunk/lib/util/sfSympalToolkit.class.php
Log:
[1.4][sfSympalPlugin][1.0] Fixing issue with custom module and actions and 
making content type module/action configurable from app.yml


Modified: plugins/sfSympalPlugin/trunk/config/app.yml
===================================================================
--- plugins/sfSympalPlugin/trunk/config/app.yml 2010-01-12 17:23:04 UTC (rev 
26542)
+++ plugins/sfSympalPlugin/trunk/config/app.yml 2010-01-12 17:38:36 UTC (rev 
26543)
@@ -14,6 +14,9 @@
     default_rendering_module: sympal_content_renderer
     default_rendering_action: index
 
+    # Configure the default content template
+    default_content_template: sympal_default/default_content_template
+
     # Configure the google analytics code to automatically add to your website
     google_analytics_code: ~
 
@@ -39,12 +42,16 @@
     # Every content type must have a template named "default_view"
     sfSympalPage:
       default_inline_editing_column_form: sfSympalPageForm
+      default_rendering_module: sympal_content_renderer
+      default_rendering_action: index
       content_templates:
         default_view:
           template: sympal_page/view
         register:
           template: sympal_register/page_template
     sfSympalContentList:
+      default_rendering_module: sympal_content_renderer
+      default_rendering_action: index
       content_templates:
         default_view:
           template: sympal_content_list/view

Modified: 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php 
    2010-01-12 17:23:04 UTC (rev 26542)
+++ 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php 
    2010-01-12 17:38:36 UTC (rev 26543)
@@ -36,19 +36,19 @@
     return $content;
   }
 
-  public function getModule()
+  public function getModuleToRenderWith()
   {
     if ($module = $this->_get('module'))
     {
       return $module;
     } else {
-      return $this->getType()->getModule();
+      return $this->getType()->getModuleToRenderWith();
     }
   }
 
   public function hasCustomAction()
   {
-    return ($this->_get('action') || 
sfSympalToolkit::moduleAndActionExists($this->getModule(), 
$this->getCustomActionName()));
+    return ($this->_get('action') || 
sfSympalToolkit::moduleAndActionExists($this->getModuleToRenderWith(), 
$this->getCustomActionName()));
   }
 
   public function getCustomActionName()
@@ -61,13 +61,13 @@
     }
   }
 
-  public function getAction()
+  public function getActionToRenderWith()
   {
     if ($this->hasCustomAction())
     {
       return $this->getCustomActionName();
     } else {
-      return $this->getType()->getAction();
+      return $this->getType()->getActionToRenderWith();
     }
   }
 
@@ -516,7 +516,7 @@
     {
       $template = $templates[$template]['template'];
     }
-    $template = $template ? $template : 
'sympal_default/default_content_template';
+    $template = $template ? $template : 
sfSympalConfig::get('default_content_template');
     return $template;
   }
 

Modified: 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentType.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentType.class.php
 2010-01-12 17:23:04 UTC (rev 26542)
+++ 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentType.class.php
 2010-01-12 17:38:36 UTC (rev 26543)
@@ -60,23 +60,23 @@
     return $this->_get('module') || 
sfSympalToolkit::moduleAndActionExists($this->getCustomModuleName(), 'index');
   }
 
-  public function getModule()
+  public function getModuleToRenderWith()
   {
     if ($this->hasCustomModule())
     {
       return $this->getCustomModuleName();
     } else {
-      return sfSympalConfig::get('default_rendering_module', null, 
'sympal_content_renderer');
+      return sfSympalConfig::get($this->getName(), 'default_rendering_module', 
sfSympalConfig::get('default_rendering_module', null, 
'sympal_content_renderer'));
     }
   }
 
-  public function getAction()
+  public function getActionToRenderWith()
   {
     if ($actionName = $this->_get('action'))
     {
       return $actionName;
     } else {
-      return sfSympalConfig::get('default_rendering_action', null, 'index');
+      return sfSympalConfig::get($this->getName(), 'default_rendering_action', 
sfSympalConfig::get('default_rendering_action', null, 'index'));
     }
   }
 }
\ No newline at end of file

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/sfSympalContentActionLoader.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/sfSympalContentActionLoader.class.php
  2010-01-12 17:23:04 UTC (rev 26542)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/sfSympalContentActionLoader.class.php
  2010-01-12 17:38:36 UTC (rev 26543)
@@ -59,7 +59,7 @@
         $this->_actions->$function($this->_request);
       }
 
-      $customTemplatePath = 
sfConfig::get('sf_apps_dir').'/'.sfConfig::get('sf_app').'/modules/'.$content->getModule().'/templates/'.$customActionName.'Success.php';
+      $customTemplatePath = 
sfConfig::get('sf_apps_dir').'/'.sfConfig::get('sf_app').'/modules/'.$content->getModuleToRenderWith().'/templates/'.$customActionName.'Success.php';
       if (file_exists($customTemplatePath))
       {
         $this->_actions->setTemplate($customActionName);

Modified: plugins/sfSympalPlugin/trunk/lib/util/sfSympalToolkit.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/util/sfSympalToolkit.class.php     
2010-01-12 17:23:04 UTC (rev 26542)
+++ plugins/sfSympalPlugin/trunk/lib/util/sfSympalToolkit.class.php     
2010-01-12 17:38:36 UTC (rev 26543)
@@ -183,8 +183,8 @@
         $routes[] = sprintf($routeTemplate,
           substr($content->getRouteName(), 1),
           $content->getRoutePath(),
-          $content->getModule(),
-          $content->getAction(),
+          $content->getModuleToRenderWith(),
+          $content->getActionToRenderWith(),
           $content->Type->name,
           $content->Type->id,
           $content->id,
@@ -202,8 +202,8 @@
         $routes[] = sprintf($routeTemplate,
           substr($contentType->getRouteName(), 1),
           $contentType->getRoutePath(),
-          $contentType->getModule(),
-          $contentType->getAction(),
+          $contentType->getModuleToRenderWith(),
+          $contentType->getActionToRenderWith(),
           $contentType->name,
           $contentType->id,
           null,

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to