Property | Type | Description | |
---|---|---|---|
$baseurl | |||
$doTask | string | Currently public, it should be reduced to protected in the future | |
$task | string | Currently public, it should be reduced to protected in the future |
Property | Type | Description | |
---|---|---|---|
$_tempFilePath | null | Used when loading template files to avoid variable scope issues | |
$config | array | A cached copy of the configuration | |
$container | The container attached to this view | ||
$defaultModel | string | The default model | |
$doPostRender | boolean | Should I run the post-render step? | |
$doPreRender | boolean | Should I run the pre-render step? | |
$layout | string | Layout name | |
$layoutTemplate | string | Layout template | |
$modelInstances | array | Registered models | |
$name | array | The name of the view | |
$output | string | The output of the template script. | |
$renderCount | integer | The number of active rendering operations. | |
$sectionStack | array | The stack of in-progress sections. | |
$sections | array | All of the finished, captured sections. | |
$template | string | The name of the default template source file. | |
$templatePaths | array | The set of search directories for view templates | |
$viewEngineMap | array | Maps view template extensions to view engine classes | |
$viewFinder | The object used to locate view templates in the filesystem | ||
$viewTemplateAliases | array | array('userProfile' => 'site://com_foobar/users/profile') allows you to do something like $this->loadAnyTemplate('userProfile') to display the frontend view template site://com_foobar/users/profile. You can also alias one view template with another, e.g. 'site://com_something/users/profile' => 'admin://com_foobar/clients/record' |
Method | Description | |
---|---|---|
__construct ( |
Constructor. | |
__get ( string $name ) : mixed | null | Magic get method. Handles magic properties: $this->input mapped to $this->container->input | |
addCssFile ( string $uri, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) | Add a CSS file to the page generated by the CMS | |
addCssInline ( string $css, string $type = 'text/css' ) | Adds an inline stylesheet (inline CSS) to the page header | |
addJavascriptFile ( string $uri, string $version = null, string $type = 'text/javascript', boolean $defer = false, boolean $async = false ) | Add a JS script file to the page generated by the CMS. | |
addJavascriptInline ( string $script, string $type = 'text/javascript' ) | Adds an inline JavaScript script to the page header | |
addLess ( string $uri, string $cssUri, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) | Compile a LESS file into CSS and add it to the page generated by the CMS. | |
alias ( string $viewTemplate, string $alias ) : void | Add an alias for a view template. | |
appendSection ( ) : string | Stop injecting content into a section and append it. | |
decrementRender ( ) : void | Decrement the rendering counter. | |
display ( string $tpl = null ) : boolean | Overrides the default method to execute and display a template script. | |
doneRendering ( ) : boolean | Check if there are no active render operations. | |
escape ( mixed $var ) : mixed | Escapes a value for output in a view script. | |
flushSections ( ) : void | Flush all of the section contents. | |
flushSectionsIfDoneRendering ( ) : void | Flush all of the section contents if done rendering. | |
get ( string $property, string $default = null, string $modelName = null ) : mixed | Method to get data from a registered model or a property of the view | |
getContainer ( ) : |
Returns a reference to the container attached to this View | |
getDoTask ( ) | ||
getLayout ( ) : string | Get the layout. | |
getLayoutTemplate ( ) : string | Get the layout template. | |
getModel ( string $name = null ) : |
Returns a named Model object | |
getName ( ) : string | Method to get the view name | |
getTask ( ) | ||
incrementRender ( ) : void | Increment the rendering counter. | |
loadAnyTemplate ( string $uri = '', array $forceParams = [], callable $callback = null ) : string | Loads a template given any path. The path is in the format componentPart://componentName/viewName/layoutName, for example site:com_example/items/default admin:com_example/items/default_subtemplate auto:com_example/things/chair any:com_example/invoices/printpreview | |
loadHelper ( string $helperClass = null ) : void | Load a helper file | |
loadTemplate ( string $tpl = null, boolean $strict = false ) : mixed | Our function uses loadAnyTemplate to provide smarter view template loading. | |
populateFromModel ( |
This method is called by the Renderer when an XML form includes a view template. The $model variable contains the Model object instance used by the form. You can override this method to populate your View class with data from that model. | |
renderEach ( string $viewTemplate, array $data, string $eachItemName, string $empty = 'raw|' ) : string | Go through a data array and render a subtemplate against each record (think master-detail views). This is accessible through Blade templates as @each | |
setDefaultModel ( |
Pushes the default Model to the View | |
setDefaultModelName ( string $modelName ) : void | Set the name of the Model to be used by this View | |
setDoTask ( string $task ) | ||
setLayout ( string $layout ) : string | Sets the layout name to use | |
setModel ( string $modelName, |
Pushes a named model to the View | |
setPostRender ( boolean $value ) : void | Sets the post-render flag | |
setPreRender ( boolean $value ) : void | Sets the pre-render flag | |
setTask ( string $task ) | ||
startSection ( string $section, string $content = '' ) : void | Start injecting content into a section. | |
stopSection ( boolean $overwrite = false ) : string | Stop injecting content into a section. | |
yieldContent ( string $section, string $default = '' ) : string | Get the string contents of a section. | |
yieldSection ( ) : string | Stop injecting content into a section and return its contents. |
Method | Description | |
---|---|---|
addTemplatePath ( mixed $path ) : void | Adds to the search path for templates and resources. | |
evaluateTemplate ( array &$forceParams ) : string | Evaluates the template described in the _tempFilePath property | |
extendSection ( string $section, string $content ) : void | Append content to a given section. | |
getEngine ( string $path ) : FOF30\View\Engine\EngineInterface | Get the appropriate view engine for the given view template path. | |
getExtension ( string $path ) : string | Get the extension used by the view file. | |
handleViewException ( Exception $e, integer $obLevel ) : void | Handle a view exception. | |
postRender ( ) : void | Runs after rendering the view template, echoing HTML to put after the view template's generated HTML | |
preRender ( ) : void | Runs before rendering the view template, echoing HTML to put before the view template's generated HTML | |
setTemplatePath ( mixed $path ) : void | Sets an entire array of search paths for templates or resources. | |
triggerEvent ( string $event, array $arguments = [] ) : boolean | Triggers an object-specific event. The event runs both locally –if a suitable method exists– and through the Joomla! plugin system. A true/false return value is expected. The first false return cancels the event. |
Method | Description | |
---|---|---|
includeTemplateFile ( array &$forceParams ) : void | This method makes sure the current scope isn't polluted with variables when including a view template |
public __construct ( |
||
$container | The container we belong to | |
$config | array | The configuration overrides for the view |
return |
public addCssFile ( string $uri, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) | ||
$uri | string | A path definition understood by parsePath, e.g. media://com_example/css/foo.css |
$version | string | (optional) Version string to be added to the URL |
$type | string | MIME type of the stylesheeet |
$media | string | Media target definition of the style sheet, e.g. "screen" |
$attribs | array | Array of attributes |
public addCssInline ( string $css, string $type = 'text/css' ) | ||
$css | string | The stylesheet content to add |
$type | string | The MIME type of the script |
public addJavascriptFile ( string $uri, string $version = null, string $type = 'text/javascript', boolean $defer = false, boolean $async = false ) | ||
$uri | string | A path definition understood by parsePath, e.g. media://com_example/js/foo.js |
$version | string | (optional) Version string to be added to the URL |
$type | string | MIME type of the script |
$defer | boolean | Adds the defer attribute, see above |
$async | boolean | Adds the async attribute, see above |
public addJavascriptInline ( string $script, string $type = 'text/javascript' ) | ||
$script | string | The script content to add |
$type | string | The MIME type of the script |
public addLess ( string $uri, string $cssUri, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) | ||
$uri | string | A path definition understood by parsePath pointing to the source LESS file, e.g. media://com_example/less/foo.less |
$cssUri | string | A path definition understood by parsePath pointing to a precompiled CSS file, used when we can't write the generated file to the output directory, e.g. media://com_example/css/foo.css |
$version | string | (optional) Version string to be added to the URL |
$type | string | MIME type of the stylesheeet |
$media | string | Media target definition of the style sheet, e.g. "screen" |
$attribs | array | Array of attributes |
protected addTemplatePath ( mixed $path ) : void | ||
$path | mixed | The directory or stream, or an array of either, to search. |
return | void |
public appendSection ( ) : string | ||
return | string |
public decrementRender ( ) : void | ||
return | void |
public doneRendering ( ) : boolean | ||
return | boolean |
protected evaluateTemplate ( array &$forceParams ) : string | ||
$forceParams | array | Forced parameters |
return | string |
public flushSections ( ) : void | ||
return | void |
public flushSectionsIfDoneRendering ( ) : void | ||
return | void |
public get ( string $property, string $default = null, string $modelName = null ) : mixed | ||
$property | string | The name of the method to call on the Model or the property to get |
$default | string | The default value [optional] |
$modelName | string | The name of the Model to reference [optional] |
return | mixed | The return value of the method |
public getContainer ( ) : |
||
return |
protected getExtension ( string $path ) : string | ||
$path | string | |
return | string |
public getLayoutTemplate ( ) : string | ||
return | string | The layout template name |
protected handleViewException ( Exception $e, integer $obLevel ) : void | ||
$e | Exception | The exception to handle |
$obLevel | integer | The target output buffering level |
return | void |
public incrementRender ( ) : void | ||
return | void |
public loadAnyTemplate ( string $uri = '', array $forceParams = [], callable $callback = null ) : string | ||
$uri | string | The template path |
$forceParams | array | A hash array of variables to be extracted in the local scope of the template file |
$callback | callable | A method to post-process the evaluated view template |
return | string | The output of the template |
public loadHelper ( string $helperClass = null ) : void | ||
$helperClass | string | The last part of the name of the helper class. |
return | void |
public populateFromModel ( |
||
$model | The model object passed from the XML form renderer |
protected postRender ( ) : void | ||
return | void |
public renderEach ( string $viewTemplate, array $data, string $eachItemName, string $empty = 'raw|' ) : string | ||
$viewTemplate | string | The view template to use for each subitem, format componentPart://componentName/viewName/layoutName |
$data | array | The array of data you want to render. It can be a DataModel\Collection, array, ... |
$eachItemName | string | How to call each item in the loaded subtemplate (passed through $forceParams) |
$empty | string | What to display if the array is empty |
return | string |
public setDefaultModel ( |
||
$model | The model to push |
public setDefaultModelName ( string $modelName ) : void | ||
$modelName | string | The name of the Model |
return | void |
public setLayout ( string $layout ) : string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$layout | string | The layout name or a string in format :
Pushes a named model to the View
Sets the post-render flag
Sets the pre-render flag
Sets an entire array of search paths for templates or resources.
Start injecting content into a section.
Stop injecting content into a section.
EXAMPLE
Component: com_foobar, Object name: item, Event: onBeforeSomething, Arguments: array(123, 456)
The event calls:
1. $this->onBeforeSomething(123, 456)
2. Joomla! plugin event onComFoobarViewItemBeforeSomething($this, 123, 456)
Get the string contents of a section.
Stop injecting content into a section and return its contents.
Property Details
Used when loading template files to avoid variable scope issues
A cached copy of the configuration
The container attached to this view
Should I run the post-render step?
Should I run the pre-render step?
Currently public, it should be reduced to protected in the future
Layout template
Registered models
The output of the template script.
The number of active rendering operations.
The stack of in-progress sections.
All of the finished, captured sections.
Currently public, it should be reduced to protected in the future
The name of the default template source file.
The set of search directories for view templates
Maps view template extensions to view engine classes
The object used to locate view templates in the filesystem
array('userProfile' => 'site://com_foobar/users/profile')
allows you to do something like $this->loadAnyTemplate('userProfile') to display the frontend view template
site://com_foobar/users/profile. You can also alias one view template with another, e.g.
'site://com_something/users/profile' => 'admin://com_foobar/clients/record'
|