Work-around for template guessing if accessing *Edit page
authorAlexander Ebert <ebert@woltlab.com>
Thu, 5 Jul 2012 17:48:04 +0000 (19:48 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 5 Jul 2012 17:48:04 +0000 (19:48 +0200)
wcfsetup/install/files/lib/page/AbstractPage.class.php

index 31ca7ca9e0ecb502682488c349e00f0252639ab0..53c9231255ea4f0d019db8d18bff04e1cb41cb2c 100644 (file)
@@ -151,6 +151,12 @@ abstract class AbstractPage implements IPage {
                if (empty($this->templateName)) {
                        $classParts = explode('\\', get_class($this));
                        $className = preg_replace('~(Form|Page)$~', '', array_pop($classParts));
+                       
+                       // check if this an *Edit page and use the add-template instead
+                       if (substr($className, -4) == 'Edit') {
+                               $className = substr($className, 0, -4) . 'Add';
+                       }
+                       
                        $this->templateName = lcfirst($className);
                }