1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 02:04:35 +02:00

Add a new Templates::fileModified() hookable method that is called whenever a change is detected to a template file. Plus update the Template and Templates class to make it possible for runtime modification of the templates path.

This commit is contained in:
Ryan Cramer
2019-09-20 10:46:47 -04:00
parent 7a76f4b857
commit 710c222b5a
5 changed files with 95 additions and 37 deletions

View File

@@ -140,7 +140,7 @@ class Paths extends WireData {
*
*/
public function set($key, $value) {
$value = self::normalizeSeparators($value);
if(DIRECTORY_SEPARATOR != '/') $value = self::normalizeSeparators($value);
if($key == 'root') {
$this->_root = $value;
return $this;
@@ -159,7 +159,7 @@ class Paths extends WireData {
*/
public function get($key) {
static $_http = null;
if($key == 'root') return $this->_root;
if($key === 'root') return $this->_root;
$http = '';
if(is_object($key)) {
$key = "$key";
@@ -174,7 +174,7 @@ class Paths extends WireData {
$key = substr($key, 4);
$key[0] = strtolower($key[0]);
}
if($key == 'root') {
if($key === 'root') {
$value = $http . $this->_root;
} else {
$value = parent::get($key);