Hello. Tell me, please, what does this code mean?

$params->def( 'menutype', 'mainmenu' ); 

Is $ params variable assigned?

    2 answers 2

    This code means that the object contained in the $params variable called the def method with two parameters 'menutype', 'mainmenu' . Without source, it is impossible to understand how variables change within an object / class.

    • Does an object contained in the $ params variable (sorry, just recently started digging through all this) can a variable contained in an object? I can not understand your record. How so? Does the object have a variable? - deskolada 5:06
    • The $ params variable contains a link to the object, in which the def method is called. - GLAGOLA
    • I get it now. Thank you. - deskolada 5:14
    • If I answered your question, please click on the check mark under the "finger down" to answer my answer as correct - GLAGOLA
    • 3
      @GLAGOLA is Joomla) The def method is the assignment of a property, then $ params ['menutype'] after the heap of checks will be 'mainmenu'. So, just clarified. - Sh4dow

    In Joomla, this code means: if in the parameters (component / module) the value of the variable with the identifier 'menutype' , then the value of this variable will be returned. If it is not specified, then the 'mainmenu' (default value) will be returned. Those. $params->def similar to $params->get . With the only difference that get returns either the value of a variable or NULL . And def returns either the value of a variable or a default value.