WebApplication
Extends 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) :
since |
1.7.3 |
---|
Arguments
- 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
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
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
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) :
since |
3.0.1 |
---|
Arguments
- event
SessionEvent
Session event being triggered
Response
void
execute
Execute the application.
execute() :
since |
1.7.3 |
---|
Response
void
flushAssets
Flush the media version to refresh versionable assets
flushAssets() :
since |
3.2 |
---|
Response
void
getConfig
Retrieve the application configuration object.
getConfig() : \Joomla\Registry\Registry
since |
4.0.0 |
---|
Response
Registry
getDispatcher
Get the event dispatcher.
getDispatcher() : \Joomla\Event\DispatcherInterface
since |
4.0.0 |
---|---|
throws |
|
Response
DispatcherInterface
getDocument
Method to get the application document object.
getDocument() : \Joomla\CMS\Document\Document
getIdentity
Get the application identity.
getIdentity() : \Joomla\CMS\User\User
getInstance
Returns a reference to the global WebApplication object, only creating it if it doesn't already exist.
getInstance( name = null) : \Joomla\CMS\Application\WebApplication
This method must be invoked as: $web = WebApplication::getInstance();
since |
1.7.3 |
---|---|
throws |
|
deprecated |
4.0 will be removed in 6.0 Use the application service in the DI container instead Example: \Joomla\CMS\Factory::getContainer()->get($name) |
Arguments
- name
string
The name (optional) of the WebApplication class to instantiate.
Response
getLanguage
Method to get the application language object.
getLanguage() : \Joomla\CMS\Language\Language
getLogger
Get the logger.
getLogger() : \Psr\Log\LoggerInterface
since |
4.0.0 |
---|
Response
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
Document
An optional document object. If omitted, the factory document is created.
Response
WebApplication
This method is chainable.
loadIdentity
Allows the application to load a custom or default identity.
loadIdentity(\Joomla\CMS\User\User identity = null) :
since |
4.0.0 |
---|
Arguments
- identity
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
Language
An optional language object. If omitted, the factory language is created.
Response
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 |
4.3 will be removed in 6.0 The session should be injected as a service. |
Arguments
- session
Session
An optional session object. If omitted, the session is created.
Response
WebApplication
This method is chainable.
loadSystemUris
Method to load the system URI strings for the application.
loadSystemUris( requestUri = null) :
since |
1.7.3 |
---|
Arguments
- requestUri
string
An optional request URI to use instead of detecting one from the server environment variables.
Response
void
registerEvent
Registers a handler to a particular event group.
registerEvent( event, Warning: Array to string conversion in /opt/phpdoc/vendor/twig/twig/src/Extension/CoreExtension.php on line 768 |Array handler) :
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() :
since |
1.7.3 |
---|
Response
void
triggerEvent
Calls all handlers associated with an event group.
triggerEvent( eventName, array|\Joomla\Event\Event args = []) : mixed||string|int
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 |
4.0 will be removed in 6.0 Use the Dispatcher method instead Example: Factory::getApplication()->getDispatcher()->dispatch($eventName, $event); |
Arguments
- eventName
string
The event name.- args
array<string|int, mixed>|Event
An array of arguments or an Event object (optional).
Response
array<string|int, mixed>
An array of results from each function call. Note this will be an empty array if no dispatcher is set.
Properties
JComponentTitle
The application component title.
since |
4.3.0 |
---|
Type(s)
string
item_associations
The item associations
since |
4.3.0 |
---|---|
deprecated |
4.4.0 will be removed in 6.0 as this property is not used anymore |
Type(s)
int
instance
The application instance.
since |
1.7.3 |
---|
Type(s)
static