/** * Generate the checkout step * @return string */ public function generate() { // Make sure field data is available \Controller::loadDataContainer('tl_iso_product_collection'); \System::loadLanguageFile('tl_iso_product_collection'); $objTemplate = new Template($this->strTemplate); $varValue = null; $objWidget = new FormTextArea(FormTextArea::getAttributesFromDca($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField], $this->strField, $varValue, $this->strField, $this->strTable, $this)); $objWidget->storeValues = true; if (\Input::post('FORM_SUBMIT') == $this->strFormId) { $objWidget->validate(); $varValue = $objWidget->value; // Do not submit the field if there are errors if ($objWidget->hasErrors()) { $doNotSubmit = true; } elseif ($objWidget->submitInput()) { $objOrder = Isotope::getCart()->getDraftOrder(); // Store the form data $_SESSION['FORM_DATA'][$this->strField] = $varValue; // Set the correct empty value (see #6284, #6373) if ($varValue === '') { $varValue = $objWidget->getEmptyValue(); } // Set the new value if ($varValue !== $objOrder->{$this->strField}) { $objOrder->{$this->strField}; } } } $objTemplate->headline = $GLOBALS['TL_LANG'][$this->strTable][$this->strField][0]; $objTemplate->customerNotes = $objWidget->parse(); return $objTemplate->parse(); }
/** * Parse the template file and return it as string * @param array * @return string */ public function parse($arrAttributes = null) { if ($this->formcontrol_template) { $this->strTemplate = $this->formcontrol_template; global $objPage; $arrStrip = array(); // XHTML does not support maxlength if ($objPage->outputFormat == 'xhtml') { $arrStrip[] = 'maxlength'; } $this->fieldValue = specialchars(str_replace('\\n', "\n", $this->varValue)); $this->fieldAttributes = $this->getAttributes($arrStrip); } return parent::parse($arrAttributes); }