mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Simplify visibleViewBag + visibleSettings
hidden -> is_hidden
This commit is contained in:
parent
302f397835
commit
9e6d0a660c
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -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'
|
||||
];
|
||||
|
||||
|
@ -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 = [
|
||||
|
@ -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'
|
||||
];
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user