<?php
namespace Modules\Admin\Config\SupplierProducts\Fields; class View_Utils_Edit extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $possibleValues = [ 'invisible' => $this->lang['visible']['invisible'], 'optional' => $this->lang['visible']['optional'], 'mandatory' => $this->lang['visible']['mandatory'], ]; $form = \Engine\Form\General::create(); $fieldset = \Engine\Form\Container\Fieldset::create($this->lang['edit']['fieldsets']['attributes']); $form->addContainer($fieldset); $category = new \Engine\Form\Input\Radio($this->lang['edit']['formFields']['category'], 'fields[category]', $this->values['fields']['category']); $category->setPossibleValues($possibleValues); $category->setMandatory(); if ($this->values['categoryDetails']['type'] == 'none') { $category->setDisabled(); } if ($this->values['categoryDetails']['type'] == 'list') { $category->setDetails(sprintf( $this->lang['edit']['formDetails']['detailsFull'], $this->values['categoryDetails']['fieldFinalName'], $this->values['categoryDetails']['type'], implode(',',$this->values['categoryDetails']['list']))); } else { $category->setDetails(sprintf( $this->lang['edit']['formDetails']['details'], $this->values['categoryDetails']['fieldFinalName'], $this->values['categoryDetails']['type'])); } $fieldset->addElement($category); $productName = new \Engine\Form\Input\Radio($this->lang['edit']['formFields']['productName'], 'fields[productName]', $this->values['fields']['productName']); $productName->setPossibleValues($possibleValues); $productName->setMandatory(); $productName->setDetails(sprintf( $this->lang['edit']['formDetails']['details'], $this->values['productName']['fieldFinalName'], $this->values['productName']['type'])); if ($this->values['productName']['type'] == 'none') { $productName->setDisabled(); } $fieldset->addElement($productName); $fieldset = new \Engine\Form\Container\Fieldset($this->lang['edit']['fieldsets']['others']); $form->addContainer($fieldset); $localization = new \Engine\Form\Input\Radio($this->lang['edit']['formFields']['localization'], 'fields[localization]', $this->values['fields']['localization']); $localization->setMandatory(); $localization->setPossibleValues([ 'invisible' => $this->lang['visible']['invisible'], 'optional' => $this->lang['visible']['optional'], 'mandatory' => $this->lang['visible']['mandatory'], ]); $fieldset->addElement($localization); $chain = new \Engine\Form\Input\Radio($this->lang['edit']['formFields']['chain'], 'fields[chain]', $this->values['fields']['chain']); $chain->setMandatory(); $chain->setPossibleValues([ 'invisible' => $this->lang['visible']['invisible'], 'optional' => $this->lang['visible']['optional'], 'mandatory' => $this->lang['visible']['mandatory'], ]); $fieldset->addElement($chain); $address = new \Engine\Form\Input\Radio($this->lang['edit']['formFields']['address'], 'fields[address]', $this->values['fields']['address']); $address->setMandatory(); $address->setPossibleValues([ 'invisible' => $this->lang['visible']['invisible'], 'optional' => $this->lang['visible']['optional'], 'mandatory' => $this->lang['visible']['mandatory'], ]); $fieldset->addElement($address); $zipCode = new \Engine\Form\Input\Radio($this->lang['edit']['formFields']['zipCode'], 'fields[zipCode]', $this->values['fields']['zipCode']); $zipCode->setMandatory(); $zipCode->setPossibleValues([ 'invisible' => $this->lang['visible']['invisible'], 'optional' => $this->lang['visible']['optional'], 'mandatory' => $this->lang['visible']['mandatory'], ]); $fieldset->addElement($zipCode); $departure = new \Engine\Form\Input\Radio($this->lang['edit']['formFields']['departure'], 'fields[departure]', $this->values['fields']['departure']); $departure->setMandatory(); $departure->setPossibleValues([ 'invisible' => $this->lang['visible']['invisible'], 'optional' => $this->lang['visible']['optional'], 'mandatory' => $this->lang['visible']['mandatory'], ]); $fieldset->addElement($departure); $destination = new \Engine\Form\Input\Radio($this->lang['edit']['formFields']['destination'], 'fields[destination]', $this->values['fields']['destination']); $destination->setMandatory(); $destination->setPossibleValues([ 'invisible' => $this->lang['visible']['invisible'], 'optional' => $this->lang['visible']['optional'], 'mandatory' => $this->lang['visible']['mandatory'], ]); $fieldset->addElement($destination); $form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1)); return $form; } }