|
|
@@ -1005,8 +1005,10 @@ class View implements EventDispatcherInterface
|
|
|
|
|
|
/**
|
|
|
* Returns filename of given action's template file (.ctp) as a string.
|
|
|
- * CamelCased action names will be under_scored! This means that you can have
|
|
|
- * LongActionNames that refer to long_action_names.ctp views.
|
|
|
+ * CamelCased action names will be under_scored by default.
|
|
|
+ * This means that you can have LongActionNames that refer to
|
|
|
+ * long_action_names.ctp views. You can change the inflection rule by
|
|
|
+ * overriding _inflectViewFileName.
|
|
|
*
|
|
|
* @param string|null $name Controller action to find template filename for
|
|
|
* @return string Template filename
|
|
|
@@ -1031,7 +1033,7 @@ class View implements EventDispatcherInterface
|
|
|
$name = str_replace('/', DS, $name);
|
|
|
|
|
|
if (strpos($name, DS) === false && $name[0] !== '.') {
|
|
|
- $name = $templatePath . $subDir . Inflector::underscore($name);
|
|
|
+ $name = $templatePath . $subDir . $this->_inflectViewFileName($name);
|
|
|
} elseif (strpos($name, DS) !== false) {
|
|
|
if ($name[0] === DS || $name[1] === ':') {
|
|
|
if (is_file($name)) {
|
|
|
@@ -1054,6 +1056,17 @@ class View implements EventDispatcherInterface
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Change the name of a view template file into underscored format.
|
|
|
+ *
|
|
|
+ * @param string $name Name of file which should be inflected.
|
|
|
+ * @return string File name after conversion
|
|
|
+ */
|
|
|
+ protected function _inflectViewFileName($name)
|
|
|
+ {
|
|
|
+ return Inflector::underscore($name);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Check that a view file path does not go outside of the defined template paths.
|
|
|
*
|
|
|
* Only paths that contain `..` will be checked, as they are the ones most likely to
|