Components and variables can now be accessed in the page code section via `$this->foo` in addition to `$this['foo']`.
This commit is contained in:
parent
20e279bf4c
commit
76b143e8d3
|
|
@ -1,4 +1,7 @@
|
|||
* **Build 13x** (2014-08-xx)
|
||||
* **Build 14x** (2014-08-xx)
|
||||
- Components and variables can now be accessed in the page code section via `$this->foo` in addition to `$this['foo']`.
|
||||
|
||||
* **Build 139** (2014-08-18)
|
||||
- List widget has been refactored to improve efficiency.
|
||||
- Added new list column type `nameFrom` (take name from X attribute) as an alternative to `select`.
|
||||
|
||||
|
|
|
|||
|
|
@ -107,13 +107,21 @@ class CodeBase extends Extendable implements ArrayAccess
|
|||
|
||||
/**
|
||||
* This object is referenced as $this->page in Cms\Classes\ComponentBase,
|
||||
* so to avoid $this->page->page this method will proxy there.
|
||||
* so to avoid $this->page->page this method will proxy there. This is also
|
||||
* used as a helper for accessing controller variables/components easier
|
||||
* in the page code, eg. $this->foo instead of $this['foo']
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
return $this->page->{$name};
|
||||
if (($value = $this->page->{$name}) !== null)
|
||||
return $value;
|
||||
|
||||
if (array_key_exists($name, $this->controller->vars))
|
||||
return $this[$name];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue