本文整理汇总了PHP中Zend\Form\Element\Submit::setOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Submit::setOption方法的具体用法?PHP Submit::setOption怎么用?PHP Submit::setOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element\Submit
的用法示例。
在下文中一共展示了Submit::setOption方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(AuthenticationService $authService)
{
parent::__construct('login');
$this->filter = new InputFilter();
$email = new Element\Email('email');
$email->setAttribute('required', true);
$email->setAttribute('placeholder', 'Email Address');
$this->add($email);
$emailFilter = new Input('email');
$emailFilter->setRequired(true);
$this->filter->add($emailFilter);
$password = new Element\Password('password');
$password->setAttribute('required', true);
$password->setAttribute('placeholder', 'Password');
$this->add($password);
$passwordFilter = new Input('password');
$passwordFilter->setRequired(true);
$passwordFilter->getValidatorChain()->attach(new AuthValidator\Authentication(array('message' => 'Invalid email address or password', 'service' => $authService, 'adapter' => $authService->getAdapter(), 'identity' => 'email', 'credential' => 'password')));
$this->filter->add($passwordFilter);
$buttons = new Form('buttons');
$buttons->setOption('twb-layout', 'inline');
$buttons->setAttribute('class', 'form-group');
$submit = new Element\Submit('submit');
$submit->setAttribute('class', 'btn-primary pull-right');
$submit->setOption('glyphicon', 'log-in');
$submit->setLabel('Log In');
$buttons->add($submit);
$forgot = new Element\Submit('forgot');
$forgot->setAttribute('formnovalidate', true);
$forgot->setAttribute('class', 'btn-warning pull-right');
$forgot->setOption('glyphicon', 'question-sign');
$forgot->setLabel('Forgot Password');
$buttons->add($forgot);
$this->add($buttons);
}
示例2: __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);
}
示例3: __construct
public function __construct()
{
parent::__construct('password');
$this->filter = new InputFilter();
$oldPassword = new Element\Password('oldPassword');
$oldPassword->setAttribute('required', true);
$oldPassword->setAttribute('placeholder', 'Current Password');
$this->add($oldPassword);
$oldPasswordFilter = new Input('oldPassword');
$oldPasswordFilter->setRequired(true);
$this->filter->add($oldPasswordFilter);
$newPassword = new Element\Password('newPassword');
$newPassword->setAttribute('required', true);
$newPassword->setAttribute('placeholder', 'New Password');
$this->add($newPassword);
$newPasswordFilter = new Input('newPassword');
$newPasswordFilter->setRequired(true);
$newPasswordFilter->getFilterChain()->attach(new Filter\StringTrim());
$newPasswordFilter->getValidatorChain()->attach(new AppValidator\PasswordStrength());
$this->filter->add($newPasswordFilter);
$confirmPassword = new Element\Password('confirmPassword');
$confirmPassword->setAttribute('required', true);
$confirmPassword->setAttribute('placeholder', 'Confirm New Password');
$this->add($confirmPassword);
$confirmPasswordFilter = new Input('confirmPassword');
$confirmPasswordFilter->setRequired(true);
$confirmPasswordFilter->getFilterChain()->attach(new Filter\StringTrim());
$confirmPasswordFilter->getValidatorChain()->attach(new Validator\Identical('newPassword'));
$this->filter->add($confirmPasswordFilter);
$buttons = new Form('buttons');
$buttons->setOption('twb-layout', 'inline');
$buttons->setAttribute('class', 'form-group');
$submit = new Element\Submit('submit');
$submit->setAttribute('class', 'btn-primary pull-right');
$submit->setOption('glyphicon', 'lock');
$submit->setLabel('Change Password');
$buttons->add($submit);
$cancel = new Element\Submit('cancel');
$cancel->setAttribute('formnovalidate', true);
$cancel->setAttribute('class', 'btn-warning pull-right');
$cancel->setOption('glyphicon', 'ban-circle');
$cancel->setLabel('Cancel');
$buttons->add($cancel);
$this->add($buttons);
}
示例4: __construct
public function __construct(EntityRepository $repository)
{
parent::__construct('forgot');
$this->filter = new InputFilter();
$email = new Element\Email('email');
$email->setAttribute('required', true);
$email->setAttribute('placeholder', 'Email Address');
$this->add($email);
$emailFilter = new Input('email');
$emailFilter->setRequired(true);
$emailFilter->getValidatorChain()->attach(new DoctrineValidator\ObjectExists(array('message' => 'Email address not found', 'object_repository' => $repository, 'fields' => 'email')));
$this->filter->add($emailFilter);
$submit = new Element\Submit('submit');
$submit->setAttribute('class', 'btn-primary pull-right');
$submit->setOption('glyphicon', 'lock');
$submit->setLabel('Reset Password');
$this->add($submit);
}
示例5: __construct
public function __construct()
{
parent::__construct('confirm');
$buttons = new Form('buttons');
$buttons->setOption('twb-layout', 'inline');
$buttons->setAttribute('class', 'form-group');
$submit = new Element\Submit('confirm');
$submit->setAttribute('class', 'btn-primary pull-right');
$submit->setOption('glyphicon', 'lock');
$submit->setLabel('Secure Checkout with PayPal');
$buttons->add($submit);
$back = new Element\Submit('back');
$back->setAttribute('formnovalidate', true);
$back->setAttribute('class', 'btn-warning pull-right');
$back->setOption('glyphicon', 'chevron-left');
$back->setLabel('Go Back');
$buttons->add($back);
$this->add($buttons);
}
示例6: __construct
//.........这里部分代码省略.........
$password->setAttribute('required', true);
$password->setAttribute('placeholder', 'Password');
$this->add($password);
$passwordFilter = new Input('password');
$passwordFilter->setRequired(true);
$passwordFilter->getFilterChain()->attach(new Filter\StringTrim());
$passwordFilter->getValidatorChain()->attach(new AppValidator\PasswordStrength());
$this->filter->add($passwordFilter);
$confirmPassword = new Element\Password('confirmPassword');
$confirmPassword->setAttribute('required', true);
$confirmPassword->setAttribute('placeholder', 'Confirm Password');
$this->add($confirmPassword);
$confirmPasswordFilter = new Input('confirmPassword');
$confirmPasswordFilter->setRequired(true);
$confirmPasswordFilter->getFilterChain()->attach(new Filter\StringTrim());
$confirmPasswordFilter->getValidatorChain()->attach(new Validator\Identical('password'));
$this->filter->add($confirmPasswordFilter);
$firstName = new Element\Text('firstName');
$firstName->setAttribute('required', true);
$firstName->setAttribute('placeholder', 'First Name');
$this->add($firstName);
$firstNameFilter = new Input('firstName');
$firstNameFilter->setRequired(true);
$firstNameFilter->getFilterChain()->attach(new AppFilter\TitleCase());
$firstNameFilter->getFilterChain()->attach(new Filter\StringTrim());
$firstNameFilter->getFilterChain()->attach(new Filter\StripTags());
$firstNameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 35)));
$firstNameFilter->getValidatorChain()->attach(new LocaleValidator\Alpha(array('allowWhiteSpace' => true)));
$this->filter->add($firstNameFilter);
$lastName = new Element\Text('lastName');
$lastName->setAttribute('required', true);
$lastName->setAttribute('placeholder', 'Last Name');
$this->add($lastName);
$lastNameFilter = new Input('lastName');
$lastNameFilter->setRequired(true);
$lastNameFilter->getFilterChain()->attach(new AppFilter\TitleCase());
$lastNameFilter->getFilterChain()->attach(new Filter\StringTrim());
$lastNameFilter->getFilterChain()->attach(new Filter\StripTags());
$lastNameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 35)));
$lastNameFilter->getValidatorChain()->attach(new LocaleValidator\Alpha(array('allowWhiteSpace' => true)));
$this->filter->add($lastNameFilter);
$street = new Element\Text('street');
$street->setAttribute('required', true);
$street->setAttribute('placeholder', 'Street Address');
$this->add($street);
$streetFilter = new Input('street');
$streetFilter->setRequired(true);
$streetFilter->getFilterChain()->attach(new Filter\StringTrim());
$streetFilter->getFilterChain()->attach(new Filter\StripTags());
$streetFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 50)));
$this->filter->add($streetFilter);
$city = new Element\Text('city');
$city->setAttribute('required', true);
$city->setAttribute('placeholder', 'City');
$this->add($city);
$cityFilter = new Input('city');
$cityFilter->setRequired(true);
$cityFilter->getFilterChain()->attach(new Filter\StringTrim());
$cityFilter->getFilterChain()->attach(new Filter\StripTags());
$cityFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 30)));
$this->filter->add($cityFilter);
$state = new Element\Text('state');
$state->setAttribute('required', true);
$state->setAttribute('placeholder', 'State');
$this->add($state);
$stateFilter = new Input('state');
$stateFilter->setRequired(true);
$stateFilter->getFilterChain()->attach(new Filter\StringTrim());
$stateFilter->getFilterChain()->attach(new Filter\StripTags());
$stateFilter->getFilterChain()->attach(new Filter\StringToUpper());
$stateFilter->getValidatorChain()->attach(new Validator\StringLength(array('min' => 2, 'max' => 2)));
$this->filter->add($stateFilter);
$postalCode = new Element\Text('postalCode');
$postalCode->setAttribute('required', true);
$postalCode->setAttribute('placeholder', 'Postal Code');
$this->add($postalCode);
$postalCodeFilter = new Input('postalCode');
$postalCodeFilter->setRequired(true);
$postalCodeFilter->getFilterChain()->attach(new Filter\StringTrim());
$postalCodeFilter->getFilterChain()->attach(new Filter\StripTags());
$this->filter->add($postalCodeFilter);
$phone = new AppElement\Phone('phone');
$phone->setAttribute('required', true);
$phone->setAttribute('placeholder', 'Phone Number');
$this->add($phone);
$phoneFilter = new Input('phone');
$phoneFilter->setRequired(true);
$this->filter->add($phoneFilter);
$website = new Element\Url('website');
$website->setAttribute('placeholder', 'Website');
$this->add($website);
$websiteFilter = new Input('website');
$websiteFilter->setRequired(false);
$this->filter->add($websiteFilter);
$submit = new Element\Submit('submit');
$submit->setAttribute('class', 'btn-primary pull-right');
$submit->setOption('glyphicon', 'user');
$submit->setLabel('Sign Up');
$this->add($submit);
}
示例7: __construct
public function __construct(ObjectManager $objectManager)
{
parent::__construct('register');
$this->filter = new InputFilter();
$primary = new Element\Hidden('primary');
$this->add($primary);
$callName = new Element\Text('callName');
$callName->setAttribute('required', true);
$callName->setAttribute('placeholder', 'Call Name');
$this->add($callName);
$callNameFilter = new Input('callName');
$callNameFilter->setRequired(true);
$callNameFilter->getFilterChain()->attach(new AppFilter\TitleCase());
$callNameFilter->getFilterChain()->attach(new Filter\StringTrim());
$callNameFilter->getFilterChain()->attach(new Filter\StripTags());
$callNameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 15)));
$callNameFilter->getValidatorChain()->attach(new LocaleValidator\Alpha(array('allowWhiteSpace' => true)));
$this->filter->add($callNameFilter);
$regName = new Element\Text('regName');
$regName->setAttribute('placeholder', 'Registered Name');
$this->add($regName);
$regNameFilter = new Input('regName');
$regNameFilter->setRequired(false);
$regNameFilter->getFilterChain()->attach(new AppFilter\TitleCase());
$regNameFilter->getFilterChain()->attach(new Filter\StringTrim());
$regNameFilter->getFilterChain()->attach(new Filter\StripTags());
$regNameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 50)));
$regNameFilter->getValidatorChain()->attach(new Validator\Regex("/^[a-z][a-z\\'\\- ]*\$/i"));
$this->filter->add($regNameFilter);
$sex = new Element\Select('sex');
$sex->setAttribute('required', true);
$sex->setValueOptions(array(1 => 'Male', 2 => 'Female'));
$sex->setEmptyOption('Select a Sex');
$this->add($sex);
$sexFilter = new Input('sex');
$sexFilter->setRequired(true);
$this->filter->add($sexFilter);
$breed = new AppElement\ObjectLiveSearch('breed');
$breed->setOption('object_manager', $objectManager);
$breed->setOption('target_class', 'Application\\Entity\\Breed');
$breed->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array(), 'orderBy' => array('name' => 'ASC'))));
$breed->setEmptyOption('Select a Breed');
$this->add($breed);
$breedFilter = new Input('breed');
$breedFilter->setRequired(true);
$this->filter->add($breedFilter);
$dateOfBirth = new Element\Date('dateOfBirth');
$dateOfBirth->setAttribute('required', true);
$dateOfBirth->setAttribute('data-placeholder', 'Date of Birth');
// placeholder attr is invalid for date input
$dateOfBirth->setAttribute('data-mask', '0000-00-00');
$dateOfBirth->setAttribute('class', 'datepicker');
$this->add($dateOfBirth);
$dateOfBirthFilter = new Input('dateOfBirth');
$dateOfBirthFilter->setRequired(true);
$dateOfBirthFilter->getValidatorChain()->attach(new Validator\Date());
$this->filter->add($dateOfBirthFilter);
$height = new Element\Number('height');
$height->setAttribute('required', true);
$height->setAttribute('placeholder', 'Height (Inches)');
$this->add($height);
$heightFilter = new Input('height');
$heightFilter->setRequired(true);
$heightFilter->getValidatorChain()->attach(new Validator\Between(array('min' => 6, 'max' => 30)));
$this->filter->add($heightFilter);
$champion = new Element\Checkbox('champion');
$champion->setLabel('Dog is a champion of record.');
$this->add($champion);
$championFilter = new Input('champion');
$championFilter->setRequired(false);
$this->filter->add($championFilter);
$rescue = new Element\Checkbox('rescue');
$rescue->setLabel('Dog is a rescue.');
$this->add($rescue);
$rescueFilter = new Input('rescue');
$rescueFilter->setRequired(false);
$this->filter->add($rescueFilter);
$buttons = new Form('buttons');
$buttons->setOption('twb-layout', 'inline');
$buttons->setAttribute('class', 'form-group');
$submit = new Element\Submit('submit');
$submit->setAttribute('class', 'btn-primary pull-right');
$submit->setOption('glyphicon', 'circle-arrow-up');
$submit->setLabel('Register');
$buttons->add($submit);
$cancel = new Element\Submit('cancel');
$cancel->setAttribute('formnovalidate', true);
$cancel->setAttribute('class', 'btn-warning pull-right');
$cancel->setOption('glyphicon', 'ban-circle');
$cancel->setLabel('Cancel');
$buttons->add($cancel);
$this->add($buttons);
}
示例8: __construct
public function __construct(Member $memberEntity, Event $eventEntity, ObjectManager $objectManager)
{
parent::__construct('entry');
$this->filter = new InputFilter();
$dog = new AppElement\ObjectLiveSearch('dog');
$dog->setOption('object_manager', $objectManager);
$dog->setOption('target_class', 'Application\\Entity\\Dog');
$dog->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array('primary' => $memberEntity->getId()), 'orderBy' => array('callName' => 'ASC'))));
$dog->setEmptyOption('Select a Dog');
$this->add($dog);
$dogFilter = new Input('dog');
$dogFilter->setRequired(true);
$this->filter->add($dogFilter);
$entryNum = 0;
foreach ($eventEntity->getTrials() as $trialEntity) {
$trial = new Form('trial_' . $trialEntity->getId());
$trial->setLabel($trialEntity->getDateDisplay());
$this->add($trial);
foreach ($trialEntity->getTrialDivisions() as $trialDivisionEntity) {
$divisionEntity = $trialDivisionEntity->getDivision();
for ($whichDivisionNum = 1; $whichDivisionNum <= $trialDivisionEntity->getNumOffered(); $whichDivisionNum++) {
$entry = new Fieldset('entry_' . $entryNum++);
$entry->setOption('twb-layout', 'inline');
$entry->setAttribute('data-price', trim($trialDivisionEntity->getEntryFee(), '$'));
$entry->setAttribute('class', 'form-group entry-form');
$this->add($entry);
$entry->filter = new InputFilter();
$this->filter->add($entry->filter);
$hiddenTrial = new Element\Hidden('trial');
$hiddenTrial->setValue($trialEntity->getId());
$entry->add($hiddenTrial);
$hiddenDivision = new Element\Hidden('division');
$hiddenDivision->setValue($divisionEntity->getId());
$entry->add($hiddenDivision);
$whichDivision = new Element\Hidden('whichDivision');
$whichDivision->setValue($whichDivisionNum);
$entry->add($whichDivision);
$entered = new Element\Checkbox('entered');
$entered->setLabel($divisionEntity . ($trialDivisionEntity->getNumOffered() > 1 ? ' #' . $whichDivisionNum : ''));
$entry->add($entered);
$enteredFilter = new Input('entered');
$enteredFilter->setRequired(false);
$entry->filter->add($enteredFilter);
if (!$divisionEntity->isAllLevels()) {
$level = new AppElement\ObjectLiveSearch('level');
$level->setOption('object_manager', $objectManager);
$level->setOption('target_class', 'Application\\Entity\\Level');
$level->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array(), 'orderBy' => array('rank' => 'ASC'))));
$level->setEmptyOption('Select a Level');
$entry->add($level);
$levelFilter = new Input('level');
$levelFilter->setRequired(false);
$entry->filter->add($levelFilter);
}
$exhibitionOnly = new Element\Checkbox('exhibitionOnly');
$exhibitionOnly->setLabelAttributes(array('class' => 'small col-md-offset-2'));
$exhibitionOnly->setLabel('For exhibition only');
$entry->add($exhibitionOnly);
$exhibitionOnlyFilter = new Input('exhibitionOnly');
$exhibitionOnlyFilter->setRequired(false);
$entry->filter->add($exhibitionOnlyFilter);
}
}
}
$buttons = new Form('buttons');
$buttons->setOption('twb-layout', 'inline');
$buttons->setAttribute('class', 'form-group');
$submit = new Element\Submit('submit');
$submit->setAttribute('class', 'btn-event pull-right');
$submit->setOption('glyphicon', 'circle-arrow-up');
$submit->setLabel('Submit Entry');
$buttons->add($submit);
$cancel = new Element\Submit('cancel');
$cancel->setAttribute('formnovalidate', true);
$cancel->setAttribute('class', 'btn-warning pull-right');
$cancel->setOption('glyphicon', 'ban-circle');
$cancel->setLabel('Cancel');
$buttons->add($cancel);
$this->add($buttons);
}
示例9: __construct
public function __construct(EntityRepository $repository)
{
parent::__construct('apply');
$this->filter = new InputFilter();
$primary = new Element\Hidden('primary');
$this->add($primary);
$primaryFilter = new Input('primary');
$primaryFilter->getValidatorChain()->attach(new DoctrineValidator\NoObjectExists(array('message' => 'Member already owns an affiliate', 'object_repository' => $repository, 'fields' => 'primary')));
$this->filter->add($primaryFilter);
$name = new Element\Text('name');
$name->setAttribute('required', true);
$name->setAttribute('placeholder', 'Organization Name');
$this->add($name);
$nameFilter = new Input('name');
$nameFilter->setRequired(true);
$nameFilter->getFilterChain()->attach(new AppFilter\TitleCase());
$nameFilter->getFilterChain()->attach(new Filter\StringTrim());
$nameFilter->getFilterChain()->attach(new Filter\StripTags());
$nameFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 80)));
$nameFilter->getValidatorChain()->attach(new DoctrineValidator\NoObjectExists(array('message' => 'Name already in use', 'object_repository' => $repository, 'fields' => 'name')));
$this->filter->add($nameFilter);
$street = new Element\Text('street');
$street->setAttribute('required', true);
$street->setAttribute('placeholder', 'Street Address');
$this->add($street);
$streetFilter = new Input('street');
$streetFilter->setRequired(true);
$streetFilter->getFilterChain()->attach(new Filter\StringTrim());
$streetFilter->getFilterChain()->attach(new Filter\StripTags());
$streetFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 50)));
$this->filter->add($streetFilter);
$city = new Element\Text('city');
$city->setAttribute('required', true);
$city->setAttribute('placeholder', 'City');
$this->add($city);
$cityFilter = new Input('city');
$cityFilter->setRequired(true);
$cityFilter->getFilterChain()->attach(new Filter\StringTrim());
$cityFilter->getFilterChain()->attach(new Filter\StripTags());
$cityFilter->getValidatorChain()->attach(new Validator\StringLength(array('max' => 30)));
$this->filter->add($cityFilter);
$state = new Element\Text('state');
$state->setAttribute('required', true);
$state->setAttribute('placeholder', 'State');
$this->add($state);
$stateFilter = new Input('state');
$stateFilter->setRequired(true);
$stateFilter->getFilterChain()->attach(new Filter\StringTrim());
$stateFilter->getFilterChain()->attach(new Filter\StripTags());
$stateFilter->getFilterChain()->attach(new Filter\StringToUpper());
$stateFilter->getValidatorChain()->attach(new Validator\StringLength(array('min' => 2, 'max' => 2)));
$this->filter->add($stateFilter);
$postalCode = new Element\Text('postalCode');
$postalCode->setAttribute('required', true);
$postalCode->setAttribute('placeholder', 'Postal Code');
$this->add($postalCode);
$postalCodeFilter = new Input('postalCode');
$postalCodeFilter->setRequired(true);
$postalCodeFilter->getFilterChain()->attach(new Filter\StringTrim());
$postalCodeFilter->getFilterChain()->attach(new Filter\StripTags());
$this->filter->add($postalCodeFilter);
$phone = new AppElement\Phone('phone');
$phone->setAttribute('required', true);
$phone->setAttribute('placeholder', 'Phone Number');
$this->add($phone);
$phoneFilter = new Input('phone');
$phoneFilter->setRequired(true);
$this->filter->add($phoneFilter);
$email = new Element\Email('email');
$email->setAttribute('required', true);
$email->setAttribute('placeholder', 'Email Address');
$this->add($email);
$emailFilter = new Input('email');
$emailFilter->setRequired(true);
$this->filter->add($emailFilter);
$website = new Element\Url('website');
$website->setAttribute('placeholder', 'Website');
$this->add($website);
$websiteFilter = new Input('website');
$websiteFilter->setRequired(false);
$this->filter->add($websiteFilter);
$buttons = new Form('buttons');
$buttons->setOption('twb-layout', 'inline');
$buttons->setAttribute('class', 'form-group');
$submit = new Element\Submit('submit');
$submit->setAttribute('class', 'btn-primary pull-right');
$submit->setOption('glyphicon', 'circle-arrow-up');
$submit->setLabel('Apply');
$buttons->add($submit);
$cancel = new Element\Submit('cancel');
$cancel->setAttribute('formnovalidate', true);
$cancel->setAttribute('class', 'btn-warning pull-right');
$cancel->setOption('glyphicon', 'ban-circle');
$cancel->setLabel('Cancel');
$buttons->add($cancel);
$this->add($buttons);
}