73 if ( !is_null($key) ) {
74 return isset($this->
data[$key]) ? $this->
data[$key] : null;
98 $args = func_get_args();
99 if ( count($args) === 1 && is_array($args[0]) ) {
100 $this->
data = $args[0];
101 }
else if ( count($args) === 2 ) {
104 throw new InvalidArgumentException(
'Cannot set View data with provided arguments. Usage: `View::setData( $key, $value );` or `View::setData([ key => value, ... ]);`');
114 $this->
data = array_merge($this->
data, $data);
132 $this->templatesDirectory = rtrim($dir,
'/');
154 extract($this->
data);
156 if ( !file_exists($templatePath) ) {
157 throw new RuntimeException(
'View cannot render template `' . $templatePath .
'`. Template does not exist.');
160 require $templatePath;
161 return ob_get_clean();
render( $template)
Render template.
Add rich text string
The name of the decorator.
__construct()
Constructor.
getData( $key=null)
Get data.
appendData(array $data)
Append data to existing View data.
Create styles array
The data for the language used.
getTemplatesDirectory()
Get templates directory.
display( $template)
Display template.
setTemplatesDirectory( $dir)
Set templates directory.