mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Adding variable access convenience methods to View
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3423 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
4c45120b75
commit
8041562a76
1 changed files with 22 additions and 2 deletions
|
@ -453,14 +453,34 @@ class View extends Object{
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a list of variables available in the current View context
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function getVars() {
|
||||||
|
return array_keys($this->_viewVars);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the contents of the given View variable(s)
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function getVar($var) {
|
||||||
|
if (!isset($this->_viewVars[$var])) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return $this->_viewVars[$var];
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function setLayout($layout) {
|
function setLayout($layout) {
|
||||||
$this->layout = $layout;
|
$this->layout = $layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows a template or element to set a variable that will be available in
|
* Allows a template or element to set a variable that will be available in
|
||||||
* a layout or other element. Analagous to Controller::set.
|
* a layout or other element. Analagous to Controller::set.
|
||||||
|
|
Loading…
Add table
Reference in a new issue