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


PHP Fieldset::setLabel方法代码示例

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


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

示例1: addSiteEnableCheckbox

 public function addSiteEnableCheckbox($event)
 {
     $siteSettings = $this->getServiceLocator()->get('Omeka\\SiteSettings');
     $form = $event->getParam('form');
     $fieldset = new Fieldset('sharing');
     $fieldset->setLabel('Sharing');
     $enabledMethods = $siteSettings->get('sharing_methods', array());
     $fieldset->add(['name' => 'sharing_methods', 'type' => 'multiCheckbox', 'options' => ['label' => 'Enable Sharing module for these methods', 'value_options' => ['fb' => ['label' => 'Facebook', 'value' => 'fb', 'selected' => in_array('fb', $enabledMethods)], 'twitter' => ['label' => 'Twitter', 'value' => 'twitter', 'selected' => in_array('twitter', $enabledMethods)], 'tumblr' => ['label' => 'Tumblr', 'value' => 'tumblr', 'selected' => in_array('tumblr', $enabledMethods)], 'pinterest' => ['label' => 'Pinterest', 'value' => 'pinterest', 'selected' => in_array('pinterest', $enabledMethods)], 'email' => ['label' => 'Email', 'value' => 'email', 'selected' => in_array('email', $enabledMethods)], 'embed' => ['label' => 'Embed codes', 'value' => 'embed', 'selected' => in_array('embed', $enabledMethods)]]], 'attributes' => ['required' => false]]);
     $form->add($fieldset);
 }
开发者ID:omeka-s-modules,项目名称:Sharing,代码行数:10,代码来源:Module.php

示例2: prepare

 public function prepare()
 {
     if ($this->isPrepared) {
         return $this;
     }
     $email = new Email('email');
     $email->setLabel('Email');
     $password = new Password('password');
     $password->setLabel('P2assword');
     $member = new Radio('memberOf');
     $member->setValueOptions(array('__model.id__' => '__model.name__'));
     $memberOfTemplate = new TemplateCollection('memberOfTemplate');
     $memberOfTemplate->setTargetElement($member);
     $memberOf = new Fieldset('memberOfGroup');
     $memberOf->setLabel('Member of')->add($memberOfTemplate);
     $submit = new Submit('register');
     $submit->setValue('Register');
     $this->add($memberOf)->add($submit);
     return parent::prepare();
 }
开发者ID:rb-cohen,项目名称:jzform,代码行数:20,代码来源:template.php

示例3: testInvoke

 /**
  * Test invoke
  */
 public function testInvoke()
 {
     $form = new Form('test_form', array('description' => array('label' => 'form description', 'translatable' => false, 'attributes' => array('class' => 'form-description'))));
     $fieldset = new Fieldset('test_fieldset', array('description' => array('label' => 'fieldset description', 'translatable' => false)));
     $text = new Element\Text('test_text', array('description' => 'text description', 'display_group' => 'display group'));
     $hidden = new Element\Hidden('test_hidden');
     $search = new Element\Search('test_search', array('display_group' => 'display group'));
     $submit = new Element\Submit('test_submit');
     $fieldset->setLabel('fieldset label');
     $text->setLabel('text label');
     $search->setLabel('search label');
     $submit->setValue('submit label');
     $fieldset->add($text);
     $fieldset->add($hidden);
     $fieldset->add($search);
     $form->add($fieldset);
     $form->add($submit);
     $translator = $this->getMock('Zend\\I18n\\Translator\\Translator');
     $translator->expects($this->at(1))->method('translate')->with('fieldset label', 'text domain')->will($this->returnValue('fieldset label at text domain'));
     $translator->expects($this->at(2))->method('translate')->with('display group', 'text domain')->will($this->returnValue('display group at text domain'));
     $translator->expects($this->at(3))->method('translate')->with('text label', 'text domain')->will($this->returnValue('text label at text domain'));
     $translator->expects($this->at(4))->method('translate')->with('text description', 'text domain')->will($this->returnValue('text description at text domain'));
     $translator->expects($this->at(5))->method('translate')->with('search label', 'text domain')->will($this->returnValue('search label at text domain'));
     $translator->expects($this->at(6))->method('translate')->with('submit label', 'text domain')->will($this->returnValue('submit label at text domain'));
     $rendered = $this->helper($form, $translator, 'text domain');
     $this->assertTag($formMatcher = array('tag' => 'form', 'attributes' => array('name' => 'test_form')), $rendered);
     $this->assertTag(array('class' => 'form-description description', 'ancestor' => $formMatcher, 'content' => 'form description'), $rendered);
     $this->assertTag($fieldsetMatcher = array('tag' => 'fieldset', 'ancestor' => $formMatcher, 'attributes' => array('name' => 'test_fieldset')), $rendered);
     $this->assertTag(array('tag' => 'legend', 'parent' => $fieldsetMatcher, 'content' => 'fieldset label at text domain'), $rendered);
     $this->assertTag(array('class' => 'description', 'ancestor' => $fieldsetMatcher, 'content' => 'fieldset description'), $rendered);
     $this->assertTag($displayGroupMatcher = array('tag' => 'fieldset', 'ancestor' => $fieldsetMatcher, 'attributes' => array('class' => 'display-group')), $rendered);
     $this->assertTag(array('tag' => 'label', 'ancestor' => $displayGroupMatcher, 'content' => 'text label at text domain'), $rendered);
     $this->assertTag(array('tag' => 'input', 'ancestor' => $displayGroupMatcher, 'attributes' => array('type' => 'text', 'name' => 'test_fieldset[test_text]')), $rendered);
     $this->assertTag(array('tag' => 'input', 'ancestor' => $fieldsetMatcher, 'attributes' => array('type' => 'hidden', 'name' => 'test_fieldset[test_hidden]')), $rendered);
     $this->assertTag(array('tag' => 'label', 'ancestor' => $displayGroupMatcher, 'content' => 'search label at text domain'), $rendered);
     $this->assertTag(array('tag' => 'input', 'ancestor' => $displayGroupMatcher, 'attributes' => array('type' => 'search', 'name' => 'test_fieldset[test_search]')), $rendered);
     $this->assertTag(array('tag' => 'input', 'ancestor' => $formMatcher, 'attributes' => array('type' => 'submit', 'name' => 'test_submit', 'value' => 'submit label at text domain')), $rendered);
 }
开发者ID:gridguyz,项目名称:zork,代码行数:41,代码来源:FormTest.php

示例4: getRepeatYearlyFieldset

 /**
  * Builds fieldset with additional properties for the "yearly" repeat picker value.
  * It returns the built fieldset (used as a child of the "repeat" fieldset).
  * 
  * @return Fieldset
  */
 public function getRepeatYearlyFieldset()
 {
     $repeatYearlyFieldset = new Fieldset(self::YEARLY);
     $repeatYearlyFieldset->setLabel('Pick date');
     $month = new Element\Select('month');
     $month->setAttributes(array('class' => 'form-control month pull-left', 'autocomplete' => 'off'));
     $month->setValueOptions($this->_monthOptions);
     $repeatYearlyFieldset->add($month);
     $day = new Element\Number('dayOfMonth');
     $day->setValue(1);
     $day->setAttributes(array('class' => 'form-control input-day pull-left', 'autocomplete' => 'off', 'maxlength' => 2, 'min' => 1, 'max' => 31));
     $repeatYearlyFieldset->add($day);
     return $repeatYearlyFieldset;
 }
开发者ID:Kingbalou,项目名称:cronkeep,代码行数:20,代码来源:SimpleForm.php

示例5: initServer

 /**
  * Initialize Server sub form
  *
  * @param array $config Configuration
  *
  * @return Config
  */
 public function initServer($config)
 {
     //Local settings
     $localeFieldset = new Fieldset('locale');
     $localeFieldset->setLabel('Locale');
     $locale = new Element\Select('locale');
     $locale->setLabel('Server locale')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'locale')->setAttribute('class', 'form-control')->setValueOptions($config['locales']);
     $localeFieldset->add($locale);
     $this->getInputFilter()->add(array('name' => 'locale', 'required' => true, 'validators' => array(array('name' => 'not_empty'))), 'locale');
     $this->add($localeFieldset);
     //Mail settings
     $mailFieldset = new Fieldset('mail');
     $mailFieldset->setLabel('Mail');
     $mailFrom = new Element\Text('mail_from');
     $mailFrom->setLabel('From E-mail')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'mail_from')->setAttribute('class', 'form-control');
     $mailFieldset->add($mailFrom);
     $this->getInputFilter()->add(array('name' => 'mail_from_name', 'required' => true, 'validators' => array(array('name' => 'not_empty'))), 'mail_from_name');
     $mailFromName = new Element\Text('mail_from_name');
     $mailFromName->setLabel('From name')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'mail_from_name')->setAttribute('class', 'form-control');
     $mailFieldset->add($mailFromName);
     $this->getInputFilter()->add(array('name' => 'mail_from', 'required' => true, 'validators' => array(array('name' => 'not_empty'))), 'mail_from');
     $this->add($mailFieldset);
     //Web settings
     $webFieldset = new Fieldset('web');
     $webFieldset->setLabel('Web');
     $forceBackendSsl = new Element\Checkbox('force_backend_ssl');
     $forceBackendSsl->setLabel('Force backend SSL')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'force_backend_ssl')->setAttribute('class', 'input-checkbox')->setAttribute('id', 'force-backend-ssl');
     $webFieldset->add($forceBackendSsl);
     $this->getInputFilter()->add(array('name' => 'force_backend_ssl', 'required' => false), 'force_backend_ssl');
     $forceFrontendSsl = new Element\Checkbox('force_frontend_ssl');
     $forceFrontendSsl->setLabel('Force frontend SSL')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'force_frontend_ssl')->setAttribute('class', 'input-checkbox')->setAttribute('id', 'force-frontend-ssl');
     $webFieldset->add($forceFrontendSsl);
     $this->getInputFilter()->add(array('name' => 'force_frontend_ssl', 'required' => false), 'force_frontend_ssl');
     $pathFields = array('Unsecure backend base path' => 'unsecure_backend_base_path', 'Unsecure frontend base path' => 'unsecure_frontend_base_path', 'Secure backend base path' => 'secure_backend_base_path', 'Secure frontend base path' => 'secure_frontend_base_path', 'Unsecure cdn base path' => 'unsecure_cdn_base_path', 'Secure cdn base path' => 'secure_cdn_base_path');
     foreach ($pathFields as $label => $identifier) {
         $field = new Element\Text($identifier);
         $field->setLabel($label)->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', $identifier)->setAttribute('class', 'form-control');
         $webFieldset->add($field);
         $this->getInputFilter()->add(array('name' => $identifier, 'required' => false, 'validators' => array(array('name' => 'uri'))), $identifier);
     }
     $this->add($webFieldset);
     return $this;
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:50,代码来源:Config.php


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