CategoryView
Extends HtmlViewBase HTML View class for the a Category list
| since |
3.2 |
|---|---|
| package |
Joomla CMS |
Methods
__construct
Constructor
__construct(mixed||string|int config = []) :
| since |
3.0 |
|---|
Arguments
- config
array<string|int, mixed>A named configuration array for object construction. name: the name (optional) of the view (defaults to the view class name suffix). charset: the character set to use for display escape: the name (optional) of the function to use for escaping strings base_path: the parent path (optional) of the views directory (defaults to the component folder) template_plath: the path (optional) of the layout directory (defaults to base_path + /views/ + view name helper_path: the path (optional) of the helper files (defaults to base_path + /helpers/) layout: the layout (optional) to use to display the view
Response
mixed
_addPath
Adds to the search path for templates and resources.
_addPath( type, path) :
| since |
3.0 |
|---|
Arguments
- type
stringThe type of path to add.- path
mixedThe directory or stream, or an array of either, to search.
Response
void
_createFileName
Create the filename for a resource
_createFileName( type, mixed||string|int parts = []) :
| since |
3.0 |
|---|
Arguments
- type
stringThe resource type to create the filename for- parts
array<string|int, mixed>An associative array of filename information
Response
stringThe filename
_setPath
Sets an entire array of search paths for templates or resources.
_setPath( type, path) :
| since |
3.0 |
|---|
Arguments
- type
stringThe type of path to set, typically 'template'.- path
mixedThe new search path, or an array of search paths. If null or false, resets to the current directory only.
Response
void
addFeed
Method to add an alternative feed link to a category layout.
addFeed() :
| since |
3.2 |
|---|
Response
void
addHelperPath
Adds to the stack of helper script paths in LIFO order.
addHelperPath( path) :
| since |
3.0 |
|---|
Arguments
- path
mixedA directory path or an array of paths.
Response
void
addTemplatePath
Adds to the stack of view script paths in LIFO order.
addTemplatePath( path) :
| since |
3.0 |
|---|
Arguments
- path
mixedA directory path or an array of paths.
Response
void
commonCategoryDisplay
Method with common display elements used in category list displays
commonCategoryDisplay() :
| since |
3.2 |
|---|
Response
void
def
Sets a default value if not already assigned
def( property, default = null) :
| since |
1.7.0 |
|---|---|
| deprecated |
4.3.0 will be removed in 7.0 Defining dynamic properties should not be used anymore |
Arguments
- property
stringThe name of the property.- default
mixedThe default value.
Response
mixed
dispatchEvent
Dispatches the given event on the internal dispatcher, does a fallback to the global one.
dispatchEvent(\Joomla\Event\EventInterface event) :
| since |
4.1.0 |
|---|---|
| deprecated |
4.4 will be removed in 7.0. Use $this->getDispatcher() directly. |
Arguments
- event
EventInterfaceThe event
Response
void
display
Execute and display a template script.
display( tpl = null) :
| since |
3.2 |
|---|---|
| throws |
|
Arguments
- tpl
stringThe name of the template file to parse; automatically searches through the template paths.
Response
void
escape
Escapes a value for output in a view script.
escape( var) :
If escaping mechanism is htmlspecialchars, use {@link $_charset} setting.
| note |
the ENT_COMPAT flag was replaced by ENT_QUOTES in Joomla 4.0 to also escape single quotes |
|---|---|
| since |
3.0 |
Arguments
- var
mixedThe output to escape.
Response
mixedThe escaped value.
get
Method to get data from a registered model or a property of the view
get( property, default = null) :
| since |
3.0 |
|---|---|
| deprecated |
5.3.0 will be removed in 7.0. Retrieve the model with $model = $this->getModel(); and call the methods to the model directly, e.g. $model->getItems() instead of $this->get('Items'). |
Arguments
- property
stringThe name of the method to call on the model or the property to get- default
stringThe name of the model to reference or the default value [optional]
Response
mixedThe return value of the method
getCurrentUser
Returns the current user, if none is set the identity of the global app is returned. This will change in 6.0 and an empty user will be returned.
getCurrentUser() : \Joomla\CMS\User\User
getDispatcher
Get the event dispatcher.
getDispatcher() : \Joomla\Event\DispatcherInterface
The override was made to keep a backward compatibility for legacy component. TODO: Remove the override ONLY when support of Legacy components will be removed (components without Dispatcher and MVCFactory).
| since |
4.4.0 |
|---|---|
| throws |
|
Response
DispatcherInterface
getDocument
Get the Document.
getDocument() : \Joomla\CMS\Document\Document
| since |
4.4.0 |
|---|---|
| throws |
|
Response
getError
Get the most recent error message.
getError( i = null, toString = true) :
| since |
1.7.0 |
|---|---|
| deprecated |
3.1.4 will be removed in 7.0 Will be removed without replacement Catch thrown Exceptions instead of getError |
Arguments
- i
intOption error index.- toString
boolIndicates if Exception objects should return their error message.
Response
stringError message
getErrors
Return all errors, if any.
getErrors() : mixed||string|int
| since |
1.7.0 |
|---|---|
| deprecated |
3.1.4 will be removed in 7.0 Will be removed without replacement Catch thrown Exceptions instead of getErrors |
Response
array<string|int, mixed>Array of error messages.
getForm
Returns the form object
getForm() :
| since |
3.2 |
|---|
Response
mixedA \JForm object on success, false on failure
getLanguage
Get the Language.
getLanguage() : \Joomla\CMS\Language\Language
| since |
4.4.0 |
|---|---|
| throws |
|
Response
getLayout
Get the layout.
getLayout() :
| since |
3.0 |
|---|
Response
stringThe layout name
getLayoutTemplate
Get the layout template.
getLayoutTemplate() :
| since |
3.0 |
|---|
Response
stringThe layout template name
getModel
Method to get the model object
getModel( name = null) : \Joomla\CMS\MVC\Model\BaseDatabaseModel
| since |
3.0 |
|---|
Arguments
- name
stringThe name of the model (optional)
Response
BaseDatabaseModelThe model object
getName
Method to get the view name
getName() :
The model name by default parsed using the classname, or it can be set by passing a $config['name'] in the class constructor
| since |
3.0 |
|---|---|
| throws |
|
Response
stringThe name of the model
getProperties
Returns an associative array of object properties.
getProperties( public = true) : mixed||string|int
| since |
1.7.0 |
|---|---|
| see | CMSObject::get() |
| deprecated |
4.3.0 will be removed in 7.0 Create a proper getter function for the property |
Arguments
- public
boolIf true, returns only the public properties.
Response
array<string|int, mixed>
loadHelper
Load a helper file
loadHelper( hlp = null) :
| since |
3.0 |
|---|
Arguments
- hlp
stringThe name of the helper source file automatically searches the helper paths and compiles as needed.
Response
void
loadTemplate
Load a template file -- first look in the templates folder for an override
loadTemplate( tpl = null) :
| since |
3.0 |
|---|---|
| throws |
|
Arguments
- tpl
stringThe name of the template source file; automatically searches the template paths and compiles as needed.
Response
stringThe output of the template script.
prepareDocument
Method to prepares the document
prepareDocument() :
| since |
3.2 |
|---|
Response
void
set
Modifies a property of the object, creating it if it does not already exist.
set( property, value = null) :
| since |
1.7.0 |
|---|---|
| deprecated |
4.3.0 will be removed in 7.0 Create a proper setter function for the property |
Arguments
- property
stringThe name of the property.- value
mixedThe value of the property to set.
Response
mixedPrevious value of the property.
setCurrentUser
Sets the current user.
setCurrentUser(\Joomla\CMS\User\User currentUser) :
setDocument
Set the document to use.
setDocument(\Joomla\CMS\Document\Document document) :
setDocumentTitle
Sets the document title according to Global Configuration options
setDocumentTitle( title) :
| since |
3.6 |
|---|
Arguments
- title
stringThe page title
Response
void
setError
Add an error message.
setError( error) :
| since |
1.7.0 |
|---|---|
| deprecated |
3.1.4 will be removed in 7.0 Will be removed without replacement Throw an Exception instead of using setError |
Arguments
- error
stringError message.
Response
void
setLanguage
Set the language to use.
setLanguage(\Joomla\CMS\Language\Language language) :
setLayout
Sets the layout name to use
setLayout( layout) :
| since |
3.0 |
|---|
Arguments
- layout
stringThe layout name or a string in format :
Response
stringPrevious value.
setLayoutExt
Allows a different extension for the layout files to be used
setLayoutExt( value) :
| since |
3.0 |
|---|
Arguments
- value
stringThe extension.
Response
stringPrevious value
setModel
Method to add a model to the view. We support a multiple model single view system by which models are referenced by classname. A caveat to the classname referencing is that any classname prepended by \JModel will be referenced by the name without \JModel, eg. \JModelCategory is just Category.
setModel(\Joomla\CMS\MVC\Model\BaseDatabaseModel model, default = false) : \Joomla\CMS\MVC\Model\BaseDatabaseModel
| since |
3.0 |
|---|
Arguments
- model
BaseDatabaseModelThe model to add to the view.- default
boolIs this the default model?
Response
BaseDatabaseModelThe added model.
setProperties
Set the object properties based on a named array/hash.
setProperties( properties) :
| since |
1.7.0 |
|---|---|
| see | CMSObject::set() |
| deprecated |
4.3.0 will be removed in 7.0 Create a proper setter function for the property |
Arguments
- properties
mixedEither an associative array or another object.
Response
bool
setUseExceptions
If true then subclasses should throw exceptions rather than use getError and setError.
setUseExceptions( value) :
| since |
5.4.0 |
|---|---|
| deprecated |
7.0 |
Arguments
- value
boolThe value to set for the field.
Response
void
shouldUseExceptions
If true then subclasses should throw exceptions rather than use getError and setError.
shouldUseExceptions() :
| since |
5.4.0 |
|---|---|
| deprecated |
7.0 |
Response
bool
Properties
_errors
An array of error messages or Exception objects.
| since |
1.7.0 |
|---|---|
| deprecated |
3.1.4 JError has been deprecated |
Type(s)
array<string|int, mixed>
useExceptions
Use exceptions rather than getError/setError.
| since |
5.4.0 |
|---|---|
| deprecated |
7.0 |
Type(s)
bool
document
The active document object
option
The URL option for the component. It is usually passed by controller while it creates the view
| since |
3.0 |
|---|
Type(s)
string
_name
The name of the view
| since |
3.0 |
|---|
Type(s)
string
_models
Registered models
| since |
3.0 |
|---|
Type(s)
array<string|int, mixed>
_defaultModel
The default model
| since |
3.0 |
|---|
Type(s)
string
_basePath
The base path of the view
| since |
3.0 |
|---|
Type(s)
string
_layout
Layout name
| since |
3.0 |
|---|
Type(s)
string
_layoutExt
Layout extension
| since |
3.0 |
|---|
Type(s)
string
_layoutTemplate
Layout template
| since |
3.0 |
|---|
Type(s)
string
_path
The set of search directories for resources (templates)
| since |
3.0 |
|---|
Type(s)
array<string|int, mixed>
_template
The name of the default template source file.
| since |
3.0 |
|---|
Type(s)
string
_output
The output of the template script.
| since |
3.0 |
|---|
Type(s)
string
_charset
Charset to use in escaping mechanisms; defaults to urf8 (UTF-8)
| since |
3.0 |
|---|
Type(s)
string
state
State data
| since |
3.2 |
|---|
Type(s)
Registry
params
The page parameters
| since |
5.2.0 |
|---|
Type(s)
Registry
items
Category items data
| since |
3.2 |
|---|
Type(s)
array<string|int, mixed>
categories
The list of other categories for this extension.
| since |
3.2 |
|---|
Type(s)
array<string|int, mixed>
children
Child objects
| since |
3.2 |
|---|
Type(s)
array<string|int, mixed>
extension
The name of the extension for the category
| since |
3.2 |
|---|
Type(s)
string
viewName
The name of the view to link individual items to
| since |
3.2 |
|---|
Type(s)
string
defaultPageTitle
Default title to use for page title
| since |
3.2 |
|---|
Type(s)
string
runPlugins
Whether to run the standard Joomla plugin events.
Off by default for b/c
| since |
3.5 |
|---|
Type(s)
bool