WebApplication
Extends \Joomla\Application\AbstractWebApplicationBase class for a Joomla! Web application.
since |
2.5.0 |
---|---|
package |
Joomla CMS |
Methods
__construct
Class constructor.
__construct(\Joomla\CMS\Input\Input input = null, \Joomla\Registry\Registry config = null, \Joomla\Application\Web\WebClient client = null, \Psr\Http\Message\ResponseInterface response = null) : mixed
since |
1.7.3 |
---|
Arguments
- input
\Joomla\CMS\Input\Input
An optional argument to provide dependency injection for the application's input object. If the argument is a JInput object that object will become the application's input object, otherwise a default input object is created.- config
\Joomla\Registry\Registry
An optional argument to provide dependency injection for the application's config object. If the argument is a Registry object that object will become the application's config object, otherwise a default config object is created.- client
\Joomla\Application\Web\WebClient
An optional argument to provide dependency injection for the application's client object. If the argument is a WebClient object that object will become the application's client object, otherwise a default client object is created.- response
\Psr\Http\Message\ResponseInterface
An optional argument to provide dependency injection for the application's response object. If the argument is a ResponseInterface object that object will become the application's response object, otherwise a default response object is created.
Response
mixed
afterSessionStart
After the session has been started we need to populate it with some default values.
afterSessionStart(\Joomla\Session\SessionEvent event) : void
since |
3.0.1 |
---|
Arguments
- event
\Joomla\Session\SessionEvent
Session event being triggered
execute
Execute the application.
execute() : void
since |
1.7.3 |
---|
flushAssets
Flush the media version to refresh versionable assets
flushAssets() : void
since |
3.2 |
---|
getConfig
Retrieve the application configuration object.
getConfig() : \Joomla\Registry\Registry
since |
4.0.0 |
---|
Response
\Joomla\Registry\Registry
getDispatcher
Get the event dispatcher.
getDispatcher() : \Joomla\Event\DispatcherInterface
since |
4.0.0 |
---|---|
throws |
|
Response
\Joomla\Event\DispatcherInterface
getDocument
Method to get the application document object.
getDocument() : \Joomla\CMS\Document\Document
since |
1.7.3 |
---|
Response
\Joomla\CMS\Document\Document
The document object
getIdentity
Get the application identity.
getIdentity() : \Joomla\CMS\User\User
since |
4.0.0 |
---|
Response
\Joomla\CMS\User\User
getInstance
Returns a reference to the global WebApplication object, only creating it if it doesn't already exist.
getInstance(string name = null) : \Joomla\CMS\Application\WebApplication
This method must be invoked as: $web = WebApplication::getInstance();
since |
1.7.3 |
---|---|
throws |
|
deprecated |
5.0 Use \Joomla\CMS\Factory::getContainer()->get($name) instead |
Arguments
- name
string
The name (optional) of the WebApplication class to instantiate.
Response
\Joomla\CMS\Application\WebApplication
getLanguage
Method to get the application language object.
getLanguage() : \Joomla\CMS\Language\Language
since |
1.7.3 |
---|
Response
\Joomla\CMS\Language\Language
The language object
getLogger
Get the logger.
getLogger() : \Psr\Log\LoggerInterface
since |
4.0.0 |
---|
Response
\Psr\Log\LoggerInterface
loadDocument
Allows the application to load a custom or default document.
loadDocument(\Joomla\CMS\Document\Document document = null) : \Joomla\CMS\Application\WebApplication
The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create a document, if required, based on more specific needs.
since |
1.7.3 |
---|
Arguments
- document
\Joomla\CMS\Document\Document
An optional document object. If omitted, the factory document is created.
Response
\Joomla\CMS\Application\WebApplication
This method is chainable.
loadIdentity
Allows the application to load a custom or default identity.
loadIdentity(\Joomla\CMS\User\User identity = null) : $this
since |
4.0.0 |
---|
Arguments
- identity
\Joomla\CMS\User\User
An optional identity object. If omitted, a null user object is created.
Response
$this
loadLanguage
Allows the application to load a custom or default language.
loadLanguage(\Joomla\CMS\Language\Language language = null) : \Joomla\CMS\Application\WebApplication
The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create a language, if required, based on more specific needs.
since |
1.7.3 |
---|
Arguments
- language
\Joomla\CMS\Language\Language
An optional language object. If omitted, the factory language is created.
Response
\Joomla\CMS\Application\WebApplication
This method is chainable.
loadSession
Allows the application to load a custom or default session.
loadSession(\Joomla\CMS\Session\Session session = null) : \Joomla\CMS\Application\WebApplication
The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create a session, if required, based on more specific needs.
since |
1.7.3 |
---|---|
deprecated |
5.0 The session should be injected as a service. |
Arguments
- session
\Joomla\CMS\Session\Session
An optional session object. If omitted, the session is created.
Response
\Joomla\CMS\Application\WebApplication
This method is chainable.
loadSystemUris
Method to load the system URI strings for the application.
loadSystemUris(string requestUri = null) : void
since |
1.7.3 |
---|
Arguments
- requestUri
string
An optional request URI to use instead of detecting one from the server environment variables.
registerEvent
Registers a handler to a particular event group.
registerEvent(string event, callable handler) : $this
since |
4.0.0 |
---|
Arguments
- event
string
The event name.- handler
callable
The handler, a function or an instance of an event object.
Response
$this
render
Rendering is the process of pushing the document buffers into the template placeholders, retrieving data from the document and pushing it into the application response buffer.
render() : void
since |
1.7.3 |
---|
setUserFactory
Set the user factory to use.
setUserFactory(\Joomla\CMS\User\UserFactoryInterface userFactory) : void
since |
4.0.0 |
---|
Arguments
- userFactory
\Joomla\CMS\User\UserFactoryInterface
The user factory to use
triggerEvent
Calls all handlers associated with an event group.
triggerEvent(string eventName, array|\Joomla\Event\Event args = []) : array
This is a legacy method, implementing old-style (Joomla! 3.x) plugin calls. It's best to go directly through the Dispatcher and handle the returned EventInterface object instead of going through this method. This method is deprecated and will be removed in Joomla! 5.x.
This method will only return the 'result' argument of the event
since |
4.0.0 |
---|---|
throws |
|
deprecated |
5.0 |
Arguments
- eventName
string
The event name.- args
array|\Joomla\Event\Event
An array of arguments or an Event object (optional).
Response
array
An array of results from each function call. Note this will be an empty array if no dispatcher is set.