public function getForm(array $companyTypes, array $statusList) { if (!$this->form) { $companyId = new Element\Hidden(); $companyId->setName('companyId'); $name = new Element\Text(); $name->setLabel('Name')->setName("name")->setAttribute('class', 'form-control'); $phone = new Element\Text(); $phone->setLabel('Phone')->setName("phone")->setAttribute('class', 'form-control'); $address = new Element\Textarea(); $address->setLabel('Address')->setName("address")->setAttribute('class', 'form-control'); $website = new Element\Url(); $website->setLabel('Website')->setName("website")->setAttribute('class', 'form-control'); $type = new Element\Select(); $type->setName("type")->setLabel('Type')->setAttribute('class', 'form-control')->setValueOptions($companyTypes); $status = new Element\Select(); $status->setName("status")->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions($statusList); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->add($companyId); $form->add($name); $form->add($phone); $form->add($address); $form->add($website); $form->add($type); $form->add($status); $this->form = $form; } return $this->form; }
public function indexAction() { $form = new Form(); // Элемент Date/Time $dateTime = new Element\DateTime('element-date-time'); $dateTime->setLabel('Date/Time Element')->setAttributes(array('min' => '2000-01-01T00:00:00Z', 'max' => '2020-01-01T00:00:00Z', 'step' => '1')); $form->add($dateTime); // Элемент Date/Time Local $dateTime = new Element\DateTimeLocal('element-date-time-local'); $dateTime->setLabel('Date/Time Local Element')->setAttributes(array('min' => '2000-01-01T00:00:00Z', 'max' => '2020-01-01T00:00:00Z', 'step' => '1')); $form->add($dateTime); // Элемент Time $time = new Element\Time('element-time'); $time->setLabel('Time Element'); $form->add($time); // Элемент Date $date = new Element\Date('element-date'); $date->setLabel('Date Element')->setAttributes(array('min' => '2000-01-01', 'max' => '2020-01-01', 'step' => '1')); $form->add($date); // Элемент Week $week = new Element\Week('element-week'); $week->setLabel('Week Element'); $form->add($week); // Элемент Month $month = new Element\Month('element-month'); $month->setLabel('Month Element'); $form->add($month); // Элемент Email $email = new Element\Email('element-email'); $email->setLabel('Email Element'); $form->add($email); // Элемент URL $url = new Element\Url('element-url'); $url->setLabel('URL Element'); $form->add($url); // Элемент Number // $number = new Element\Number('element-number'); // $number->setLabel('Number Element'); // $form->add($number); // Элемент Range // $range = new Element\Range('element-range'); // $range->setLabel('Range Element'); // $form->add($range); // Элемент Color $color = new Element\Color('element-color'); $color->setLabel('Color Element'); $form->add($color); return array('form' => $form); }
public function __construct($name = null) { parent::__construct('links'); $weight_hidden = new Element\Hidden('weight'); $title_text = new Element\Text('name'); $title_text->setLabel('Title'); $title_text->setLabelAttributes(array('class' => 'type_text')); $title_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => true)); $url_text = new Element\Url('ref'); $url_text->setLabel('Url'); $url_text->setLabelAttributes(array('class' => 'type_text')); $url_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => true)); $description_textarea = new Element\Textarea('description'); $description_textarea->setLabel('Description'); $description_textarea->setLabelAttributes(array('class' => 'type_text')); $description_textarea->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...')); $this->add($weight_hidden); $this->add($title_text); $this->add($url_text); $this->add($description_textarea); }
public function getForm() { if (!$this->form) { $contactId = new Element\Hidden(); $contactId->setName('contactId'); $name = new Element\Text(); $name->setLabel('Name')->setName("name")->setAttribute('class', 'form-control'); $phone = new Element\Text(); $phone->setLabel('Phone')->setName("phone")->setAttribute('class', 'form-control'); $email = new Element\Email(); $email->setLabel('Email')->setName("email")->setAttribute('class', 'form-control'); $address = new Element\Textarea(); $address->setLabel('Address')->setName("address")->setAttribute('class', 'form-control'); $website = new Element\Url(); $website->setLabel('Website')->setName("website")->setAttribute('class', 'form-control'); $selectCompany = new Element\Select(); $selectCompany->setName('companyId')->setLabel('Company')->setAttribute('class', 'form-control')->setEmptyOption("---Choose Company---")->setValueOptions($this->companies); $notes = new Element\Textarea(); $notes->setLabel('Notes')->setName("notes")->setAttribute('class', 'form-control'); $tag = new Element\Text(); $tag->setLabel('Tag')->setName("tag")->setAttribute('class', 'form-control'); $status = new Element\Select(); $status->setName('status')->setLabel('Status')->setAttribute('class', 'form-control')->setValueOptions(array('A' => 'Active', 'D' => 'Inactive')); $form = new Form(); $form->setAttribute('class', 'form-horizontal'); $form->setAttribute('enctype', 'multipart/form-data'); $form->add($contactId); $form->add($name); $form->add($phone); $form->add($email); $form->add($address); $form->add($website); $form->add($selectCompany); $form->add($notes); $form->add($tag); $form->add($status); $this->form = $form; } return $this->form; }
/** * Load upload editor * * @return mixed */ public function load() { $property = $this->getProperty(); $value = @unserialize($this->getValue()); $originalUrl = !empty($value[0]) ? $value[0] : ''; $tinyUrl = !empty($value[1]) ? $value[1] : ''; $textstring = new Element\Url($this->getName()); $textstring->setAttribute('class', 'form-control'); $textstring->setAttribute('id', $this->getName()); $textstring->setLabel($property->getName()); $textstring->setValue($originalUrl); $textstring->setAttribute('required', $property->isRequired()); $data = array($textstring); if (!empty($tinyUrl)) { $html = '<div class="col-lg-2"> </div><div class="col-lg-10 bg-warning">'; $html .= sprintf('<a href="%s" target="_blank" class="btn btn-link">', $tinyUrl); $html .= $tinyUrl; $html .= '</a></div>'; $data[] = $html; } return $data; }
public function __construct($name = null) { parent::__construct($name); $this->add(new Element\Hidden('latitude')); $this->add(new Element\Hidden('longitude')); $bool_apt = new Element\Radio('bool_apt'); $bool_apt->setLabel('Is POBox?')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'No', '0' => 'Yes'))->setAttributes(array('class' => 'medwhite')); $this->add($bool_apt); $apt_or_pobox = new Element\Text('apt_or_pobox'); $apt_or_pobox->setLabel('Apartment No. or PO Box')->setAttributes(array('class' => 'form-control input-sm')); $this->add($apt_or_pobox); $street_line1 = new Element\Text('street_line1'); $street_line1->setLabel('Street Line 1')->setAttributes(array('class' => 'form-control input-sm')); $this->add($street_line1); $street_line2 = new Element\Text('street_line2'); $street_line2->setLabel('Street Line 2')->setAttributes(array('class' => 'form-control input-sm')); $this->add($street_line2); $city = new Element\Text('city'); $city->setLabel('City')->setAttributes(array('class' => 'form-control input-sm')); $this->add($city); $state_or_province = new Element\Select('state_or_province'); $state_or_province->setLabel('State or Province')->setAttributes(array('class' => 'form-control input-sm')); $this->add($state_or_province); $country = new Element\Select('country'); $country->setLabel('Country')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('' => 'Select a country')); $this->add($country); $zipcode = new Element\Text('zipcode'); $zipcode->setLabel('Zip Code')->setAttributes(array('class' => 'form-control input-sm')); $this->add($zipcode); $url_map = new Element\Url('url_map'); $url_map->setLabel('Map Url')->setAttributes(array('class' => 'form-control input-sm')); $this->add($url_map); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'form-control input-sm')); $this->add($comment); }
public function buildForm() { $this->setAttributes(array('id' => 'post-form', 'method' => 'post')); $category = new Element\Select('category'); $category->setLabel('Categoria'); $category->setValueOptions(array_combine($this->categories, $this->categories)); $category->setAttribute('class', 'form-control'); $title = new Element\Text('title'); $title->setLabel('Título'); $title->setAttributes(array('maxlength' => 128, 'class' => 'form-control')); $description = new Element\Textarea('description'); $description->setAttribute('class', 'form-control'); $description->setLabel('Descrição'); $photoFilename = new Element\Url('photo_filename'); $photoFilename->setAttribute('class', 'form-control'); $photoFilename->setLabel('Foto'); $contactName = new Element\Text('contact_name'); $contactName->setAttribute('class', 'form-control'); $contactName->setLabel('Nome completo'); $contactEmail = new Element\Email('contact_email'); $contactEmail->setAttribute('class', 'form-control'); $contactEmail->setLabel('E-mail'); $contactPhone = new Element\Text('contact_phone'); $contactPhone->setAttribute('class', 'form-control'); $contactPhone->setLabel('Contato'); $cityCode = new Element\Select('cityCode'); $cityCode->setAttribute('class', 'form-control'); $cityCode->setValueOptions($this->cities); $cityCode->setLabel('Cidade'); $deleteCode = new Element\Number('delete_code'); $deleteCode->setAttribute('class', 'form-control'); $deleteCode->setLabel('Código de deleção'); $captcha = new Element\Captcha('captcha'); $captchaAdapter = new ImageCaptcha(array('font' => './public/fonts/arial.ttf', 'imgDir' => './public/img/captcha', 'imgUrl' => '/img/captcha')); $captchaAdapter->setWordlen(4); $captcha->setCaptcha($captchaAdapter)->setLabel('Você é um ser humano ou um robô?')->setAttribute('class', 'captchaStyle')->setAttribute('title', 'Você é um ser humano ou um robô?'); /*$captcha = new Element\Captcha('captcha'); $captcha->setCaptcha(new \Zend\Captcha\Dumb()); $captcha->setAttribute('class', 'form-control'); $captcha->setOptions(array('label' => 'Você é um ser humano ou um robô?')); */ $price = new Element\Number('price'); $price->setAttributes(array('class' => 'form-control', 'maxlength' => 12, 'min' => 0, 'max' => '999999999999')); $price->setLabel('Preço'); $dateExpires = new Element\Radio('date_expires'); $dateExpires->setLabel('Expira em (dias)'); $dateExpires->setValueOptions(array_combine($this->dateExpires, $this->dateExpires)); $csrf = new Element\Csrf('security'); $submit = new Element\Submit('submit'); $submit->setAttributes(array('class' => 'btn btn-default', 'value' => 'Enviar formulário')); $this->add($category)->add($title)->add($price)->add($dateExpires)->add($description)->add($photoFilename)->add($contactName)->add($contactEmail)->add($contactPhone)->add($cityCode)->add($deleteCode)->add($captcha)->add($csrf)->add($submit); /* $factory = new \Zend\Form\Factory(); $factory->createForm(array( 'hydrator' => 'Zend\Stdlib\Hydrator\ArraySerializable', 'elements' => array( array( 'name' => 'category', 'type' => 'text', 'options' => array( 'label' => 'Category' ) ), array( 'name' => 'title', 'type' => 'text', 'options' => array( 'label' => 'Title' ) ), ) )); */ }
public function __construct() { parent::__construct('online'); $this->setHydrator(new ArraySerializableHydrator(false)); $adress_text = new Element\Url('url'); $adress_text->setLabel('Url'); $adress_text->setLabelAttributes(array('class' => 'type_text')); $adress_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type adress in format', 'required' => true)); $this->add($adress_text); $this->add(array('type' => 'Button', 'name' => 'submit', 'options' => array('label' => 'delete'), 'attributes' => array('class' => 'btn btn btn_red3'))); }
/** * Prepara os campos do formulário * @param string $fieldName * @param array $fieldParams * @param array $options * @return object * @throws Exception */ private function prepareFields($fieldName, array $fieldParams, array $options = array()) { $element = null; $extraLabel = " "; $this->aOptions = array(); $this->aAttributes = array(); /* Define o tooltip do campo */ $tooltip = (isset($fieldParams['tooltip']) and $fieldParams['tooltip'] == 'true') ? "<a class=\"tooltip-marc\" href=\"#\" data-toggle=\"tooltip\" title=\"{$this->getTranslator($fieldName . '_tooltip')}\">[?]</a>" : null; $this->aOptions['tooltip'] = $tooltip; /* Define como será mostrado o nome do campo (se é obrigatório ou não) */ if (strtolower($fieldParams['type']) != 'hidden') { if (isset($fieldParams['validation']) and stristr(strtolower($fieldParams['validation']), "required")) { $extraLabel = " * "; } } switch (strtolower($fieldParams['type'])) { /* Caso hidden */ case 'primary': case 'hidden': $element = new ZendFormElement\Hidden($fieldName); break; /* Caso Csrf */ /* Caso Csrf */ case 'csrf': case 'sec': $element = new ZendFormElement\Csrf($fieldName); $element->setCsrfValidatorOptions(array('timeout' => '600')); break; /* Caso text */ /* Caso text */ case 'text': $element = new ZendFormElement\Text($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['class'] = 'form-input'; break; /* Caso textarea */ /* Caso textarea */ case 'textarea': $element = new ZendFormElement\Textarea($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); /* Define os padrões de colunas e linhas do campo */ $this->aAttributes['rows'] = (isset($fieldParams['rows']) and !empty($fieldParams['rows'])) ? $fieldParams['rows'] : 5; $this->aAttributes['cols'] = (isset($fieldParams['cols']) and !empty($fieldParams['cols'])) ? $fieldParams['cols'] : 10; $this->aAttributes['class'] = 'form-input'; $this->aAttributes['data-editor'] = 'false'; break; /* Caso editor */ /* Caso editor */ case 'editor': $element = new ZendFormElement\Textarea($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); /* Define os padrões de colunas e linhas do campo */ $this->aAttributes['rows'] = (isset($fieldParams['rows']) and !empty($fieldParams['rows'])) ? $fieldParams['rows'] : 5; $this->aAttributes['cols'] = (isset($fieldParams['cols']) and !empty($fieldParams['cols'])) ? $fieldParams['cols'] : 10; /* Verifica se utilizará o editor */ $this->aAttributes['class'] = 'editorw'; $this->aAttributes['data-editor'] = 'true'; /* Verifica a pasta de upload */ if (isset($this->formDefaultConfig['destination']) and !empty($this->formDefaultConfig['destination'])) { /* Caso não exista a pasta cria o mesmo */ if (!is_dir(UPLOAD_PATH . $this->formDefaultConfig['destination'])) { mkdir(UPLOAD_PATH . $this->formDefaultConfig['destination'], 0777, true); chmod(UPLOAD_PATH . $this->formDefaultConfig['destination'], 0777); } $_SESSION['KCFINDER'] = array(); $_SESSION['KCFINDER']['disabled'] = false; $_SESSION['KCFINDER']['uploadURL'] = URL_UPLOAD . $this->formDefaultConfig['destination']; $_SESSION['KCFINDER']['uploadDir'] = UPLOAD_PATH . $this->formDefaultConfig['destination']; } else { throw new \Exception('Defina a pasta de destino de upload das imagens do editor!', 500); } break; /* Caso password */ /* Caso password */ case 'password': $element = new ZendFormElement\Password($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['renderPassword'] = true; $this->aAttributes['class'] = 'form-input'; break; /* Caso radio */ /* Caso radio */ case 'radio': $element = new ZendFormElement\Radio($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['class'] = 'radio'; break; /* Caso checkbox */ /* Caso checkbox */ case 'checkbox': $element = new ZendFormElement\Checkbox($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $element->setUncheckedValue(null); $this->aAttributes['class'] = 'checkbox'; break; /* Caso multicheckbox */ /* Caso multicheckbox */ case 'multicheckbox': $element = new ZendFormElement\MultiCheckbox($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $element->setUncheckedValue(null); break; /* Caso select */ /* Caso select */ case 'select': $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true)); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->selectOptions = array(); if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') { $this->selectOptions[''] = $this->getTranslator($fieldName . '_placeholder'); } else { $this->selectOptions[''] = "---------"; } $this->aAttributes['class'] = 'form-input-select'; break; /* Caso selectgroup */ /* Caso selectgroup */ case 'selectgroup': $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true)); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->selectOptions = array(); if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') { $this->selectOptions[''] = $this->getTranslator($fieldName . '_placeholder'); } else { $this->selectOptions[''] = "---------"; } $this->aAttributes['class'] = 'form-input-select'; break; /* Caso multiselect */ /* Caso multiselect */ case 'multiselect': $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true)); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['class'] = 'form-input-select ms'; $this->aAttributes['multiple'] = 'multiple'; break; /* Caso fileimage */ /* Caso fileimage */ case 'fileimage': $element = new ZendFormElement\File($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); //$this->aAttributes['multiple'] = true; $this->aAttributes['class'] = 'hiddenImageFile'; /* Verifica a pasta de upload */ if (isset($this->formDefaultConfig['pathfiles']) and !empty($this->formDefaultConfig['pathfiles'])) { /* Caso não exista a pasta cria o mesmo */ if (!is_dir(UPLOAD_PATH . $this->formDefaultConfig['pathfiles'])) { mkdir(UPLOAD_PATH . $this->formDefaultConfig['pathfiles'], 0777, true); chmod(UPLOAD_PATH . $this->formDefaultConfig['pathfiles'], 0777); } $this->aAttributes['data-path'] = LINK_DEFAULT . 'uploads/' . $this->formDefaultConfig['pathfiles']; } else { throw new \Exception('Defina a pasta de destino de upload das imagens do editor!', 500); } break; /* Caso file */ /* Caso file */ case 'file': $element = new ZendFormElement\File($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); break; case 'money': $element = new ZendFormElement\Text($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['class'] = 'form-input'; break; /* HTML5 Elements */ /* Caso url */ /* HTML5 Elements */ /* Caso url */ case 'url': $element = new ZendFormElement\Url($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['class'] = 'form-input'; break; /* Caso date */ /* Caso date */ case 'date': $element = new ZendFormElement\Date($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['min'] = date("Y") - 10 . '-01-01'; $this->aAttributes['max'] = date("Y") + 10 . '-12-31'; $this->aAttributes['class'] = 'form-input'; break; case 'dateage': $element = new ZendFormElement\Date($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['min'] = date("Y") - 100 . '-01-01'; $this->aAttributes['max'] = date("Y") + 100 . '-12-31'; $this->aAttributes['class'] = 'form-input'; break; /* Caso time */ /* Caso time */ case 'time': $element = new ZendFormElement\DateTime($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['class'] = 'form-input'; $this->aAttributes['min'] = '00:00:00'; $this->aAttributes['max'] = '23:59:59'; $this->aOptions['format'] = 'H:i:s'; break; /* Caso date */ /* Caso date */ case 'datetime': $element = new ZendFormElement\DateTime($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['min'] = date("Y") - 10 . '-01-01 00:00:00'; $this->aAttributes['max'] = date("Y") + 10 . '-12-31 23:59:59'; $this->aAttributes['class'] = 'form-input'; break; /* Caso email */ /* Caso email */ case 'email': $element = new ZendFormElement\Email($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['class'] = 'form-input'; break; /* Caso number */ /* Caso number */ case 'number': $element = new ZendFormElement\Number($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['step'] = '1'; $this->aAttributes['class'] = 'form-input'; break; case 'integer': $element = new ZendFormElement\Number($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['min'] = '0'; $this->aAttributes['max'] = '99999999999999999999'; $this->aAttributes['step'] = '1'; $this->aAttributes['class'] = 'form-input'; break; case 'float': $element = new ZendFormElement\Number($fieldName); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); $this->aAttributes['step'] = '0.001'; $this->aAttributes['class'] = 'form-input'; break; /* Plataforma */ /* Caso select */ /* Plataforma */ /* Caso select */ case 'status': $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true)); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') { $this->selectOptions[''] = $this->getTranslator($fieldName . '_placeholder'); } else { $this->selectOptions[''] = "---------"; } $this->aAttributes['class'] = 'form-input-select'; break; /* Caso boolean */ /* Caso boolean */ case 'boolean': $element = new ZendFormElement\Select($fieldName, array('disable_inarray_validator' => true)); $element->setLabel($this->getTranslator($fieldName) . $extraLabel); if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') { $this->selectOptions[''] = $this->getTranslator($fieldName . '_placeholder'); } else { $this->selectOptions[''] = "---------"; } $this->aAttributes['class'] = 'form-input-select'; break; } /* Verifica se foi setado classe de estilo e implementa */ if (isset($fieldParams['class']) and !empty($fieldParams['class'])) { if (isset($this->aAttributes['class']) and $this->aAttributes['class'] != "") { $this->aAttributes['class'] = $this->aAttributes['class'] . " " . $fieldParams['class']; } else { $this->aAttributes['class'] = $fieldParams['class']; } } /* Define a descrição abaixo do campo */ if (isset($fieldParams['description']) and $fieldParams['description'] == 'true') { $this->aOptions['help-block'] = $this->getTranslator($fieldName . '_description'); } /* Verifica se foi setado grupo do campo e implementa */ if (isset($fieldParams['group']) and !empty($fieldParams['group'])) { $this->aOptions['group'] = $fieldParams['group']; } /* Verifica se foi setado placeholder no campo e implementa */ if (isset($fieldParams['placeholder']) and strtolower($fieldParams['placeholder']) == 'true') { $this->aAttributes['placeholder'] = $this->getTranslator($fieldName . '_placeholder'); } /* Verifica se foi setado somente leitura e implementa */ if (isset($fieldParams['readonly']) and strtolower($fieldParams['readonly']) == 'true') { $this->aAttributes['readonly'] = 'readonly'; } /* Verifica se foi setado desabilitado e implementa */ if (isset($fieldParams['disabled']) and strtolower($fieldParams['disabled']) == 'true') { $this->aAttributes['disabled'] = true; } /* Verifica se utilizará mascara no campo */ if (isset($fieldParams['mask']) and !empty($fieldParams['mask'])) { $this->aAttributes['data-inputmask'] = $fieldParams['mask']; } /* Verifica se foi setado inputgroup tipo append e implementa */ if (isset($fieldParams['groupappend']) and !empty($fieldParams['groupappend'])) { $this->aOptions['add-on-append'] = $fieldParams['groupappend']; } /* Verifica se foi setado inputgroup tipo prepend e implementa */ if (isset($fieldParams['groupprepend']) and !empty($fieldParams['groupprepend'])) { $this->aOptions['add-on-prepend'] = $fieldParams['groupprepend']; } /* Verifica se foi setado como array e implementa */ if (isset($fieldParams['array']) and strtolower($fieldParams['array']) == 'true') { $this->aOptions['disable_inarray_validator'] = false; } if (strtolower($fieldParams['type']) !== 'checkbox' and strtolower($fieldParams['type']) !== 'button') { if (strtolower($fieldParams['type']) !== 'textarea' and strtolower($fieldParams['type']) !== 'editor') { //$this->aOptions['column-size'] = 'col4'; } else { //$this->aOptions['column-size'] = 'col6'; } $this->aOptions['labelattributes'] = array('class' => 'form-label'); } else { //$this->aOptions['column-size'] = 'col6 col-sm-offset-2'; unset($this->aOptions['labelattributes']); } return array('element' => $element, 'params' => $fieldParams); }