/** * Clean up all the fields for this form. * * This will unset all the fields associated with this form. This will remove * all circular references to this form so it can be cleaned up by the garbage collector. * This should only be called when the form is no longer needed. Trying to access it * after this may cause unexpected results or errors. */ public function cleanup($remove_from_cache = true) { if ($this->parentField instanceof I2CE_FormField) { $this->parentField->cleanup(); } unset($this->parentField); if ($this->lastModifiedField instanceof I2CE_FormField) { $this->lastModifiedField->cleanup(); } if ($this->createdField instanceof I2CE_FormField) { $this->createdField->cleanup(); } unset($this->lastModifiedField); unset($this->createdField); I2CE_ModuleFactory::callHooks('form_cleanup', array('form' => $this, 'remove_from_cache' => $remove_from_cache)); parent::cleanup($remove_from_cache); }