本文整理汇总了PHP中Venne\Forms\Form::addDynamic方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addDynamic方法的具体用法?PHP Form::addDynamic怎么用?PHP Form::addDynamic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Venne\Forms\Form
的用法示例。
在下文中一共展示了Form::addDynamic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$group = $form->addGroup('Registration');
$userTypes = array();
foreach ($this->securityManager->getUserTypes() as $name => $val) {
$userTypes[$name] = $val->getName();
}
$registrations = $form->addDynamic('registrations', function (Container $registration) use($form, $group, $userTypes) {
$group = $form->addGroup('Registration');
$registration->setCurrentGroup($group);
$registration->addCheckbox('enabled', 'Enabled')->addCondition($form::EQUAL, TRUE)->toggle('reg-' . $registration->name);
$registration->setCurrentGroup($registration->form->addGroup()->setOption('id', 'reg-' . $registration->name));
$registration->addText('name', 'Name');
$registration->addSelect('userType', 'Type', $userTypes);
$registration->addSelect('mode', 'Mode', PageEntity::getModes())->addCondition($form::IS_IN, array(PageEntity::MODE_MAIL, PageEntity::MODE_MAIL_CHECKUP))->toggle('email-' . $registration->name);
$registration->addSelect('loginProviderMode', 'Login provider mode', PageEntity::getSocialModes());
$registration->addMultiSelect('roles', 'Roles', $this->getRoles());
$email = $registration->addContainer('email');
$email->setCurrentGroup($form->addGroup()->setOption('id', 'email-' . $registration->name));
$email->addText('subject', 'Subject');
$email->addText('sender', 'Sender');
$email->addText('from', 'From');
$email->addTextArea('text', 'Text');
$registration->addSubmit('_remove', 'Remove')->addRemoveOnClick();
}, 1);
$registrations->setCurrentGroup($group);
$registrations->addSubmit('_add', 'Add')->addCreateOnClick();
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例2: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$toolbar = $form->addDynamic('toolbar', function (Container $container) use($form) {
$group = $form->addGroup('Toolbar line');
$container->setCurrentGroup($group);
$line = $container->addDynamic('line', function (Container $container) use($form, $group) {
$container->setCurrentGroup($group);
/** @var TagsInput $tags */
$tags = $container->addTags('items', 'Group');
$_this = $this;
$tags->setSuggestCallback(function ($filters) use($_this) {
return $_this->getToolbarItems($filters);
});
$container->addSubmit('remove', 'Remove group')->addRemoveOnClick();
});
$line->addSubmit('add', 'Add group')->addCreateOnClick();
$container->addSubmit('remove', 'Remove line')->addRemoveOnClick();
});
$toolbar->addSubmit('add', 'Add line')->addCreateOnClick();
$form->setCurrentGroup();
$form->addSaveButton('Save');
}