Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.


y2kbgy2kbg New
edited January 2007 in Vanilla 1.0 Help
So what does the $Context do here?
not the $Context->Objec.....
Is it a parameter for the Constructor function in that class?
$EasySettingsForm = $Context->ObjectFactory->NewContextObject($Context,'EasySettingsForm');


  • Options
    When you use NewContextObject, $Context is passed as the first argument in the object constructor. Any of the arguments posted after the name of the class are also passed as arguments to the constructor. I have no idea how EasySettingsForm is set up, but this is probably how the constructor declaration looks:

    class EasySettingsForm { //pass $Context by reference (that's what the & means). - This is important in PHP 4, superflous in PHP5. function EasySettingsForm(&$Context) { } }

    I am not sure why the $Context is passed when it is "NewObject" rather than "NewContextObject", but I do know that with NewContextObject the $Context object is passed as an argument to the constructor.
  • Options
    passing the $Context object into other objects is a nicer way of using "global $myvar". It allows your class to do things with the Context object, like reading configuration parameters, get user info, or create objects within objects :P Aah... the joy of OOP :P
  • Options
    thanks! That cleared things up well.
This discussion has been closed.