What does getApplication
mean?
I understand instance of class like Input
, Registry
, and String
.
What about Application
? What does it include? Why do we need this class?
What does getApplication
mean?
I understand instance of class like Input
, Registry
, and String
.
What about Application
? What does it include? Why do we need this class?
According to the Joomla API reference manual getApplication returns the global CMSApplication object, only creating it if it doesn't already exist.
Imagine getApplication calls the guts behind Joomla to be used in all of your other site methods.
As an example:
$app = JFactory::getApplication();
//SAY YOU WANT TO SET A USER STATE VALUE
$app->setUserState('option.mystate','1');
getApplication references all of the other needed functionality for Joomla that allows you to access the core methods of the CMS, in this instance setUserState.