本文整理汇总了PHP中Zend\Form\Form::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::remove方法的具体用法?PHP Form::remove怎么用?PHP Form::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Form
的用法示例。
在下文中一共展示了Form::remove方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
/**
* {@inheritDoc}
*/
public function getForm()
{
$currentStep = $this->getCurrentStep();
if (!$currentStep) {
return;
}
if (null === $this->form) {
$this->form = $this->formFactory->create();
$this->form->setAttribute('action', sprintf('?%s=%s', $this->getOptions()->getTokenParamName(), $this->getUniqueId()));
if (!$this->getSteps()->getPrevious($currentStep)) {
$this->form->remove('previous');
}
if (!$this->getSteps()->getNext($currentStep)) {
$this->form->remove('next');
} else {
$this->form->remove('valid');
}
}
$stepForm = $currentStep->getForm();
if ($stepForm instanceof Form) {
if ($this->form->has(self::STEP_FORM_NAME)) {
$this->form->remove(self::STEP_FORM_NAME);
}
$stepForm->setName(self::STEP_FORM_NAME);
$stepForm->populateValues($currentStep->getData());
$this->form->add($stepForm);
}
return $this->form;
}
示例2: getNoteForm
/**
* @param Entity\Note $note
* @param string $url
* @param string $action
* @param array $members
* @return \Zend\Form\Form
*/
public function getNoteForm(Entity\Note $note, $url = '', $action = 'add', $members = null)
{
if (is_null($this->noteForm)) {
$builder = new AnnotationBuilder($this->getEntityManager());
$this->noteForm = $builder->createForm($note);
$this->noteForm->setAttribute('action', $url);
$this->noteForm->setAttribute('id', 'noteForm');
$this->noteForm->setHydrator(new DoctrineObject($this->getEntityManager(), 'Secretary\\Entity\\Note'));
$this->noteForm->bind($note);
if ($action == 'edit' && $note->getPrivate() === false) {
$this->noteForm->remove('private');
$group = $note->getGroup();
$membersString = $this->getMembersString(array_keys($members));
$this->noteForm->get('groupHidden')->setValue($group->getId());
$this->noteForm->get('members')->setValue($membersString);
$this->noteForm->getInputFilter()->remove('__initializer__');
$this->noteForm->getInputFilter()->remove('__cloner__');
$this->noteForm->getInputFilter()->remove('__isInitialized__');
$this->noteForm->getInputFilter()->remove('lazyPropertiesDefaults');
} else {
$this->noteForm->get('private')->setAttribute('required', false);
$this->noteForm->getInputFilter()->get('private')->setRequired(false);
}
}
return $this->noteForm;
}
示例3: fixUserForm
/**
* @param \Zend\Form\Form $form
*/
protected function fixUserForm(Form &$form, $userId = null)
{
$auth = $this->getAuthenticationService();
$groupId = $form->get('groupId');
$groups = $groupId->getValueOptions();
if (empty($groups) || $auth->getIdentity()->id == $userId) {
$form->remove('groupId');
}
}
示例4: testAddRemove
public function testAddRemove()
{
$form = clone $this->form;
$this->assertEquals($form, $this->form);
$file = new Element\File('file_resource');
$this->form->add($file);
$this->assertTrue($this->form->has('file_resource'));
$this->assertNotEquals($form, $this->form);
$this->form->remove('file_resource');
$this->assertEquals($form, $this->form);
}
示例5: remove
/**
* Override Form remove function to perform additional operations
* @param string $element
*/
public function remove($element)
{
unset($this->rawElements[$element]);
return parent::remove($element);
}
示例6: remove
/**
* {@inheritDoc}
*/
public function remove($elementOrFieldset)
{
if (!parent::has($elementOrFieldset)) {
if ($elementOrFieldset === 'captcha') {
$elementOrFieldset = $this->getCaptchaElementName();
} elseif ($elementOrFieldset === 'csrf') {
$elementOrFieldset = $this->getCsrfElementName();
}
}
return parent::remove($elementOrFieldset);
}
示例7: removeFormElement
/**
*
* @param type $elementName
* @throws Exception
*/
public function removeFormElement($elementName)
{
if (!$this->isLoadCrudSettings()) {
return false;
}
if (!$this->frmMainCrud instanceof \Zend\Form\Form) {
throw new Exception('You must define a Form object', $code, $previous);
}
if (!$priority) {
$priority = $this->frmMainCrud->get($elementName)->getOption('priority');
}
$this->frmMainCrud->remove($elementName);
return true;
}
示例8: addSubmitButton
public function addSubmitButton(Form $subForm)
{
$subForm->remove("btnSalvar");
$subForm->add(['type' => 'Button', 'name' => 'btnSalvar', 'attributes' => ['class' => 'btn btn-default', 'type' => 'button'], 'options' => ['label' => 'Salvar e Continuar']]);
return $this;
}