当前位置: 首页>>代码示例>>PHP>>正文


PHP Text::setAttribute方法代码示例

本文整理汇总了PHP中Zend\Form\Element\Text::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::setAttribute方法的具体用法?PHP Text::setAttribute怎么用?PHP Text::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Form\Element\Text的用法示例。


在下文中一共展示了Text::setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     $code = new Text('code');
     $code->setAttribute('id', 'code');
     $code->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('readonly', 'readonly')->setAttribute('placeholder', $this->translator->translate('template.form.code.placeholder'))->setLabel($this->translator->translate('template.form.code.label'));
     $this->add($code);
     $name = new Text('name');
     $name->setAttribute('id', 'name');
     $name->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('template.form.name.placeholder'))->setLabel($this->translator->translate('template.form.name.label'));
     $this->add($name);
     $titleEt = new Text('titleEt');
     $titleEt->setAttribute('id', 'titleEt');
     $titleEt->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('template.form.titleEt.placeholder'))->setLabel($this->translator->translate('template.form.titleEt.label'));
     $this->add($titleEt);
     $titleEn = new Text('titleEn');
     $titleEn->setAttribute('id', 'titleEn');
     $titleEn->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('template.form.titleEn.placeholder'))->setLabel($this->translator->translate('template.form.titleEn.label'));
     $this->add($titleEn);
     $contentEt = new Textarea('contentEt');
     $contentEt->setAttribute('id', 'contentEt');
     $contentEt->setAttribute('required', 'required')->setAttribute('class', 'editor')->setAttribute('placeholder', $this->translator->translate('template.form.contentEt.placeholder'))->setLabel($this->translator->translate('template.form.contentEt.label'));
     $contentEt->setAttribute('cols', 15);
     $contentEt->setAttribute('rows', 4);
     $this->add($contentEt);
     $contentEn = new Textarea('contentEn');
     $contentEn->setAttribute('id', 'contentEn');
     $contentEn->setAttribute('required', 'required')->setAttribute('class', 'editor')->setAttribute('placeholder', $this->translator->translate('template.form.contentEn.placeholder'))->setLabel($this->translator->translate('template.form.contentEn.label'));
     $contentEn->setAttribute('cols', 15);
     $contentEn->setAttribute('rows', 4);
     $this->add($contentEn);
     return $this;
 }
开发者ID:kristjanAnd,项目名称:SimpleIV,代码行数:32,代码来源:TemplateForm.php

示例2: init

 public function init()
 {
     $username = new Element\Text('username');
     $username->setAttribute('class', 'form-control');
     $username->setAttribute('placeholder', 'Username');
     $username->setAttribute('required', true);
     $this->add($username);
     $password = new Element\Text('password');
     $password->setAttribute('class', 'form-control');
     $password->setAttribute('placeholder', 'Password');
     $password->setAttribute('required', true);
     $this->add($password);
     $confirmPassword = new Element\Text('confirm_password');
     $confirmPassword->setAttribute('class', 'form-control');
     $confirmPassword->setAttribute('placeholder', 'Confirm Password');
     $confirmPassword->setAttribute('required', true);
     $this->add($confirmPassword);
     $email = new Element\Email('email');
     $email->setAttribute('class', 'form-control');
     $email->setAttribute('placeholder', 'Email');
     $email->setAttribute('required', true);
     $this->add($email);
     $firstName = new Element\Text('first_name');
     $firstName->setAttribute('class', 'form-control');
     $firstName->setAttribute('placeholder', 'First Name');
     $firstName->setAttribute('required', true);
     $this->add($firstName);
     $lastName = new Element\Text('last_name');
     $lastName->setAttribute('class', 'form-control');
     $lastName->setAttribute('placeholder', 'Last Name');
     $lastName->setAttribute('required', true);
     $this->add($lastName);
 }
开发者ID:petresevic,项目名称:test,代码行数:33,代码来源:RegisterForm.php

示例3: addElements

 public function addElements()
 {
     //-- Profile name --
     $login = new Element\Text('profile_name');
     $login->setAttribute('placeholder', 'profile_name');
     $login->setAttribute('required', 'true');
     $login->setAttribute('class', 'form-control');
     $login->setAttribute('id', 'profile-name');
     $login->setLabel('Profile name');
     $login->setLabelAttributes(array('class' => 'control-label', 'for' => 'profile-name'));
     //-- Password --
     $password = new Element\Password('password');
     $password->setAttribute('placeholder', '*****');
     $password->setAttribute('required', 'true');
     $password->setAttribute('class', 'form-control');
     $password->setAttribute('id', 'password');
     $password->setLabel('Password');
     $password->setLabelAttributes(array('class' => 'control-label', 'for' => 'password'));
     //-- Submit --
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn btn-success');
     $submit->setValue('Send');
     // Binding elements
     $this->add($login);
     $this->add($password);
     $this->add($submit);
 }
开发者ID:anton-phpcurs,项目名称:aperture,代码行数:27,代码来源:LoginForm.php

示例4: init

 public function init()
 {
     parent::__construct('forgotPassword');
     $email = new Text('email');
     $email->setAttribute('id', 'email');
     $email->setAttribute('required', 'required')->setAttribute('placeholder', $this->translator->translate('forgotPassword.email.placeholder'));
     $this->add($email);
     $submit = new Submit('submit');
     $submit->setAttribute('class', 'button');
     $submit->setValue($this->translator->translate('forgotPassword.submit.value'));
     $this->add($submit);
     return $this;
 }
开发者ID:kristjanAnd,项目名称:SimpleIV,代码行数:13,代码来源:ForgotPassword.php

示例5: init

 public function init()
 {
     $username = new Element\Text('username');
     $username->setAttribute('class', 'form-control');
     $username->setAttribute('placeholder', 'Username');
     //$username->setAttribute('required', true);
     $this->add($username);
     $password = new Element\Password('password');
     $password->setAttribute('class', 'form-control');
     $password->setAttribute('placeholder', 'Password');
     //$password->setAttribute('required', true);
     $this->add($password);
 }
开发者ID:petresevic,项目名称:test,代码行数:13,代码来源:LoginForm.php

示例6: __construct

 public function __construct()
 {
     parent::__construct('search');
     $this->setAttribute('class', 'pull-left');
     $this->setAttribute('method', 'GET');
     $q = new Element\Text('q');
     $q->setAttribute('placeholder', 'Search...');
     $q->setAttribute('required', true);
     $this->add($q);
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'search');
     $submit->setLabel('Search');
     $this->add($submit);
 }
开发者ID:PoetikDragon,项目名称:USCSS,代码行数:15,代码来源:Search.php

示例7: load

 /**
  * Load textstring editor
  *
  * @return Element\Text
  */
 public function load()
 {
     $parameters = $this->getConfig();
     $property = $this->getProperty();
     $textstring = new Element\Text($this->getName());
     $textstring->setAttribute('class', 'form-control');
     $textstring->setLabel($property->getName());
     $textstring->setAttribute('id', $this->getName());
     $textstring->setValue($this->getValue());
     $textstring->setAttribute('required', $property->isRequired());
     if (!empty($parameters['length'])) {
         $textstring->setAttribute('maxlength', $parameters['length']);
     }
     return $textstring;
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:20,代码来源:Editor.php

示例8: init

 public function init()
 {
     $name = new Text('name');
     $name->setAttribute('id', 'name');
     $name->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.name.placeholder'))->setLabel($this->translator->translate('company.form.name.label'));
     $this->add($name);
     $regNo = new Text('regNo');
     $regNo->setAttribute('id', 'regNo');
     $regNo->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.regNo.placeholder'))->setLabel($this->translator->translate('company.form.regNo.label'));
     $this->add($regNo);
     $kmkrNo = new Text('kmkrNo');
     $kmkrNo->setAttribute('id', 'kmkrNo');
     $kmkrNo->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.kmkrNo.placeholder'))->setLabel($this->translator->translate('company.form.kmkrNo.label'));
     $this->add($kmkrNo);
     $address = new Text('address');
     $address->setAttribute('id', 'address');
     $address->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.address.placeholder'))->setLabel($this->translator->translate('company.form.address.label'));
     $this->add($address);
     $zip = new Text('zip');
     $zip->setAttribute('id', 'zip');
     $zip->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.zip.placeholder'))->setLabel($this->translator->translate('company.form.zip.label'));
     $this->add($zip);
     $country = new Text('country');
     $country->setAttribute('id', 'country');
     $country->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.country.placeholder'))->setLabel($this->translator->translate('company.form.country.label'));
     $this->add($country);
     $city = new Text('city');
     $city->setAttribute('id', 'city');
     $city->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.city.placeholder'))->setLabel($this->translator->translate('company.form.city.label'));
     $this->add($city);
     $url = new Text('url');
     $url->setAttribute('id', 'url');
     $url->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.url.placeholder'))->setLabel($this->translator->translate('company.form.url.label'));
     $this->add($url);
     $phone = new Text('phone');
     $phone->setAttribute('id', 'phone');
     $phone->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.phone.placeholder'))->setLabel($this->translator->translate('company.form.phone.label'));
     $this->add($phone);
     $email = new Text('email');
     $email->setAttribute('id', 'email');
     $email->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.email.placeholder'))->setLabel($this->translator->translate('company.form.email.label'));
     $this->add($email);
     $mob = new Text('mob');
     $mob->setAttribute('id', 'mob');
     $mob->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.mob.placeholder'))->setLabel($this->translator->translate('company.form.mob.label'));
     $this->add($mob);
     return $this;
 }
开发者ID:kristjanAnd,项目名称:SimpleIV,代码行数:48,代码来源:CompanyForm.php

示例9: addStep

 private function addStep($index)
 {
     $stepIdElement = new Hidden('StepId' . $index);
     $stepIdElement->setValue($index);
     $this->add($stepIdElement);
     $quantityElement = new Text('StepQuantityValue' . $index);
     $quantityElement->setLabel('Menge');
     $quantityElement->setAttribute('id', 'StepQuantityValue' . $index);
     $this->add($quantityElement);
     $units = $this->selectAllFrom('Units', 'Name');
     $unitElement = new Select('StepUnit' . $index);
     $unitElement->setValueOptions($units);
     // need to set default value. otherwise null is saved.
     $unitElement->setValue(0);
     $unitElement->setAttribute('id', 'StepUnit' . $index);
     $this->add($unitElement);
     $ingredients = $this->selectAllFrom('Ingredients', 'Name');
     $ingredientElement = new Select('StepIngredient' . $index);
     $ingredientElement->setValueOptions($ingredients);
     //just set any default value. inserting ingredients has to be workes out anyway
     $ingredientElement->setValue(0);
     $ingredientElement->setAttribute('id', 'StepIngredient' . $index);
     $this->add($ingredientElement);
     $textElement = new Textarea('StepText' . $index);
     $textElement->setAttribute('id', 'StepText' . $index);
     $this->add($textElement);
 }
开发者ID:bbuehler99,项目名称:zend1,代码行数:27,代码来源:AddRecipeForm.php

示例10: addTitleElement

 /**
  * Add title element
  */
 public function addTitleElement($name = 'title')
 {
     $element = new Text($name);
     $element->setLabel('Überschrift');
     $element->setAttribute('class', 'span5');
     $this->add($element);
 }
开发者ID:andreaszobl,项目名称:software,代码行数:10,代码来源:BlogForm.php

示例11: addToElement

 /**
  * Add name element
  */
 public function addToElement($to = 'to')
 {
     $element = new Text($to);
     $element->setLabel('bis');
     $element->setAttribute('class', 'datepicker form-control');
     $this->add($element);
 }
开发者ID:andreaszobl,项目名称:software,代码行数:10,代码来源:RentalsForm.php

示例12: addLastnameElement

 /**
  * Add lastname element
  */
 public function addLastnameElement($name = 'lastname')
 {
     $element = new Text($name);
     $element->setLabel('Nachname');
     $element->setAttribute('class', 'form-control input-small');
     $this->add($element);
 }
开发者ID:andreaszobl,项目名称:software,代码行数:10,代码来源:UserForm.php

示例13: testCanRenderFieldsets

 /**
  * @outputBuffering disabled
  */
 public function testCanRenderFieldsets()
 {
     $this->expectOutputRegex('/<form(.*)<fieldset(.*)<\\/fieldset>(.*)<fieldset(.*)<\\/fieldset>(.*)<\\/form>/');
     $form = new NetsensiaForm();
     $form->addHidden('test1', 'testvalue');
     $hidden = new Element\Hidden('asdasd');
     $hidden->setValue('123');
     $form->add($hidden);
     $element1 = new Text('testelement1');
     $element1->setLabel('Test Element');
     $element1->setAttribute('icon', 'pencil');
     $element2 = new Text('testelement2');
     $element2->setLabel('Test Element 2');
     $element2->setAttribute('icon', 'pencil');
     $fieldset1 = new Fieldset('testfieldset1');
     $fieldset1->add($element1);
     $fieldset2 = new Fieldset('testfieldset2');
     $fieldset2->add($element2);
     $form->add($fieldset1);
     $form->add($fieldset2);
     $helpers = new HelperPluginManager();
     $helpers->setService('formElement', new FormElement());
     $view = new PhpRenderer();
     $view->setHelperPluginManager($helpers);
     $viewHelper = new BootstrapForm();
     $viewHelper->setView($view);
     $viewHelper($form, 'testform', '/');
 }
开发者ID:netsensia,项目名称:zf2-foundation,代码行数:31,代码来源:BootstrapFormTest.php

示例14: init

 public function init()
 {
     $code = new Text('code');
     $code->setAttribute('id', 'code');
     $code->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.code.placeholder'))->setLabel($this->translator->translate('vatUom.form.code.label'));
     $this->add($code);
     $value = new Text('value');
     $value->setAttribute('id', 'value');
     $value->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.value.placeholder'))->setLabel($this->translator->translate('vatUom.form.value.label'));
     $this->add($value);
     $comment = new Text('comment');
     $comment->setAttribute('id', 'comment');
     $comment->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.comment.placeholder'))->setLabel($this->translator->translate('vatUom.form.comment.label'));
     $this->add($comment);
     return $this;
 }
开发者ID:kristjanAnd,项目名称:SimpleIV,代码行数:16,代码来源:VatUomForm.php

示例15: __construct

 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('fTransaction');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'post');
     $filter = $this->getInputFilter();
     $basicGroup = new DisplayGroup('basicGroup');
     $this->add($basicGroup);
     $companyId = $this->addElementCompany('companyId', $basicGroup, ['required' => true]);
     $applyDate = new Text('applyDate');
     $applyDate->setLabel('Ngày hạch toán:');
     $applyDate->setAttribute('class', 'datepicker');
     $this->add($applyDate);
     $basicGroup->addElement($applyDate);
     $applyDate->setValue(DateBase::toDisplayDate(DateBase::getCurrentDate()));
     $filter->add(array('name' => 'applyDate', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập ngày hạch toán'))))));
     $description = new Text('description');
     $description->setLabel('Nội dung:');
     $this->add($description);
     $basicGroup->addElement($description);
     $filter->add(array('name' => 'description', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập nội dung phiếu thu'))))));
     $accountId = new Select('accountId');
     $accountId->setLabel('Quỹ thu:');
     $accountId->setValueOptions(['' => '- Quỹ thu -']);
     $this->loadAccountingAccount($accountId, $companyId);
     $this->add($accountId);
     $basicGroup->addElement($accountId);
     $filter->add(array('name' => 'accountId', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập quỹ thu'))), array('name' => 'InArray', 'break_chain_on_failure' => true, 'options' => array('haystack' => array_keys($accountId->getValueOptions()), 'messages' => array('notInArray' => 'Bạn chưa nhập quỹ thu'))))));
     $items = new Hidden('items');
     $this->add($items);
     $filter->add(array('name' => 'items', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập chi tiết các khoản thu'))))));
     $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/accounting/transaction/addreqrecieve'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/accounting/transaction/addreqrecieve' => 'Tiếp tục nhập', '/accounting/transaction/index' => 'Hiện danh sách vừa nhập'))));
     $this->add(array('name' => 'btnSubmit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'button', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary')));
 }
开发者ID:NguyenQuiDuong,项目名称:Funixtest,代码行数:34,代码来源:ReqRecieve.php


注:本文中的Zend\Form\Element\Text::setAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。