diff --git a/CHANGELOG.md b/CHANGELOG.md index 1016590c5..7110ea411 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ * **Build 26x** (2015-06-xx) - Improved the back-end administrator permissions UI. + - The page setting `hidden` has been renamed to `is_hidden`, this setting may need to be reapplied for some themes. * **Build 260** (2015-05-16) - The `|page` filter now supports passing an empty string to generate a link to the current page. diff --git a/modules/cms/classes/CmsCompoundObject.php b/modules/cms/classes/CmsCompoundObject.php index b6ed95cda..6803dd8a1 100644 --- a/modules/cms/classes/CmsCompoundObject.php +++ b/modules/cms/classes/CmsCompoundObject.php @@ -49,6 +49,9 @@ class CmsCompoundObject extends CmsObject */ public $viewBag = []; + /** + * @var array Properties that can be set with fill() + */ protected static $fillable = [ 'markup', 'settings', @@ -56,14 +59,16 @@ class CmsCompoundObject extends CmsObject 'fileName' ]; - protected $settingsVisible = []; + /** + * @var array These properties will be available as regular properties, + * by looking the settings and viewBag values. + */ + protected $visible = []; protected $settingsValidationRules = []; protected $settingsValidationMessages = []; - protected $viewBagVisible = []; - protected $viewBagValidationRules = []; protected $viewBagValidationMessages = []; @@ -106,24 +111,26 @@ class CmsCompoundObject extends CmsObject } /** - * Implements getter functionality for properties defined in the settings section. + * Implements getter functionality for visible properties defined in + * the settings section or view bag array. */ public function __get($name) { - if ( - is_array($this->settings) && - array_key_exists($name, $this->settings) && - array_key_exists($name, array_flip($this->settingsVisible)) - ) { - return $this->settings[$name]; - } + $visibleKeys = array_flip($this->visible); + if (isset($visibleKeys[$name])) { + if ( + is_array($this->settings) && + array_key_exists($name, $this->settings) + ) { + return $this->settings[$name]; + } - if ( - is_array($this->viewBag) && - array_key_exists($name, $this->viewBag) && - array_key_exists($name, array_flip($this->viewBagVisible)) - ) { - return $this->viewBag[$name]; + if ( + is_array($this->viewBag) && + array_key_exists($name, $this->viewBag) + ) { + return $this->viewBag[$name]; + } } return parent::__get($name); diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index 049b16181..5f30a194a 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -154,7 +154,7 @@ class Controller * Hidden page */ $page = $this->router->findByUrl($url); - if ($page && $page->hidden) { + if ($page && $page->is_hidden) { if (!BackendAuth::getUser()) { $page = null; } @@ -461,20 +461,21 @@ class Controller /** * Post-processes page HTML code before it's sent to the client. + * Note for pre-processing see cms.template.processTwigContent event. * @param \Cms\Classes\Page $page Specifies the current CMS page. * @param string $url Specifies the current URL. - * @param string $html The page markup to post processs. + * @param string $content The page markup to post processs. * @return string Returns the updated result string. */ - protected function postProcessResult($page, $url, $html) + protected function postProcessResult($page, $url, $content) { - $html = MediaViewHelper::instance()->processHtml($html); + $content = MediaViewHelper::instance()->processHtml($content); - $holder = (object) ['html' => $html]; + $dataHolder = (object) ['content' => $content]; - Event::fire('cms.page.postprocess', [$this, $url, $page, $holder]); + Event::fire('cms.page.postprocess', [$this, $url, $page, $dataHolder]); - return $holder->html; + return $dataHolder->content; } // diff --git a/modules/cms/classes/Layout.php b/modules/cms/classes/Layout.php index ea9330c81..54954d370 100644 --- a/modules/cms/classes/Layout.php +++ b/modules/cms/classes/Layout.php @@ -11,9 +11,10 @@ class Layout extends CmsCompoundObject const FALLBACK_FILE_NAME = 'fallback'; /** - * @var array These settings properties will be available as regular properties. + * @var array These properties will be available as regular properties, + * by looking the settings and viewBag values. */ - protected $settingsVisible = [ + protected $visible = [ 'description' ]; diff --git a/modules/cms/classes/Page.php b/modules/cms/classes/Page.php index 113899f49..55148e265 100644 --- a/modules/cms/classes/Page.php +++ b/modules/cms/classes/Page.php @@ -14,21 +14,23 @@ use Lang; class Page extends CmsCompoundObject { /** - * @var array The API bag allows the API handler code to bind arbitrary data to the page object. + * @var array The API bag allows the API handler code to bind arbitrary + * data to the page object. */ public $apiBag = []; /** - * @var array These settings properties will be available as regular properties. + * @var array These properties will be available as regular properties, + * by looking the settings and viewBag values. */ - protected $settingsVisible = [ + protected $visible = [ 'title', 'url', 'layout', 'description', 'meta_title', 'meta_description', - 'hidden' + 'is_hidden' ]; protected $settingsValidationRules = [ diff --git a/modules/cms/classes/Partial.php b/modules/cms/classes/Partial.php index 109a5b68b..bb9f06584 100644 --- a/modules/cms/classes/Partial.php +++ b/modules/cms/classes/Partial.php @@ -9,9 +9,10 @@ class Partial extends CmsCompoundObject { /** - * @var array These settings properties will be available as regular properties. + * @var array These properties will be available as regular properties, + * by looking the settings and viewBag values. */ - protected $settingsVisible = [ + protected $visible = [ 'description' ]; diff --git a/modules/cms/classes/page/fields.yaml b/modules/cms/classes/page/fields.yaml index fecdfc487..e2b23c9a1 100644 --- a/modules/cms/classes/page/fields.yaml +++ b/modules/cms/classes/page/fields.yaml @@ -58,7 +58,7 @@ tabs: type: textarea size: tiny - settings[hidden]: + settings[is_hidden]: tab: cms::lang.editor.settings label: cms::lang.editor.hidden type: checkbox