You are here

public function HostingForm::__construct in Aegir Objects 7.3

Contructor method.

Classes based on HostingForm should be instantiated by passing in $form and $form_state, such as from hook_form_alter(), validate or submit callbacks. These get passed by reference, so that any changes made need not be returned back to the calling function.

File

classes/HostingForm.inc, line 25
The HostingForm class.

Class

HostingForm
@file The HostingForm class.

Code

public function __construct(&$form = [], &$form_state = [], $node = FALSE) {
  $this->form =& $form;
  $this->form_state =& $form_state;
  if ($node) {
    $this->node = $node;
  }
  elseif (isset($form['#node'])) {
    $this->node = $form['#node'];
  }
  elseif (isset($form_state['node'])) {
    $this->node = $form_state['node'];
  }
  elseif (isset($form_state['build_info']['args'][0])) {
    $this->node = $form_state['build_info']['args'][0];
  }
}