本文整理汇总了PHP中Venne\Forms\Form::addOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addOne方法的具体用法?PHP Form::addOne怎么用?PHP Form::addOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Venne\Forms\Form
的用法示例。
在下文中一共展示了Form::addOne方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
public function configure(Form $form)
{
$group = $form->addGroup();
$form->addText('name', 'Name');
$form->addOne('route')->setCurrentGroup($group)->addTextArea('notation', 'Description', NULL, 4);
$form->addSaveButton('Save');
}
示例2: addMailform
/**
* @param Form $form
* @param $name
* @return \DoctrineModule\Forms\Containers\EntityContainer
*/
public function addMailform($form, $name)
{
/** @var $container Form */
$container = $form->addOne($name);
$container->setCurrentGroup($form->addGroup('Sender'));
$container->addCheckbox('sendCopyToSender', 'Send copy to sender')->addCondition($form::EQUAL, true)->toggle('copyHeader')->toggle('copyRecipient');
$container->setCurrentGroup($group = $form->addGroup());
$group->setOption('id', 'copyHeader');
$container->addTextArea('copyHeader', 'Header of copy')->getControlPrototype()->attrs['class'] = 'input-block-level';
$container->setCurrentGroup($form->addGroup('Recipient'));
$container->addTags('emails', 'E-mails')->addRule($form::FILLED, 'Please set e-mail.');
$container->setCurrentGroup($group = $form->addGroup());
$group->setOption('id', 'copyRecipient');
$container->addText('recipient', 'Recipient name')->addConditionOn($container['sendCopyToSender'], $form::EQUAL, true)->addRule($form::FILLED, 'Please set recipient name.');
$container->setCurrentGroup($group = $form->addGroup());
$container->addText('subject', 'Subject')->addRule($form::FILLED, 'Please set subject.');
$container->addCheckbox('ownTemplate', 'Advanced options')->addCondition($form::EQUAL, true)->toggle('template');
$container->setCurrentGroup($group = $form->addGroup());
$group->setOption('id', 'template');
$container->addTextarea('template', 'Mail template')->getControlPrototype()->attrs['class'] = 'input-block-level';
$container->setCurrentGroup($group = $form->addGroup('Inputs'));
$mainContainer = $container;
/** @var $items \Nette\Forms\Container */
$items = $container->addMany('inputs', function (\Nette\Forms\Container $container) use($group, $form, $mainContainer) {
$container->setCurrentGroup($group);
$container->addText('label', 'Label');
$container->addSelect('type', 'Type', InputEntity::getTypes())->addCondition($form::IS_IN, array(InputEntity::TYPE_CHECKBOX_LIST, InputEntity::TYPE_RADIO_LIST, InputEntity::TYPE_SELECT))->toggle("frm{$form->getUniqueId()}-{$mainContainer->getName()}-inputs-{$container->getName()}-items-pair")->endCondition()->addCondition($form::IS_IN, array(InputEntity::TYPE_CHECKBOX, InputEntity::TYPE_TEXT, InputEntity::TYPE_TEXTAREA, InputEntity::TYPE_CHECKBOX_LIST, InputEntity::TYPE_RADIO_LIST, InputEntity::TYPE_SELECT))->toggle("frm{$form->getUniqueId()}-{$mainContainer->getName()}-inputs-{$container->getName()}-required-pair");
$container->addTags('items', 'Items');
$container->addCheckbox('required', 'Required');
$container->addSubmit('remove', 'Remove input')->addRemoveOnClick();
});
$items->setCurrentGroup($group = $form->addGroup());
$items->addSubmit('add', 'Add input')->setValidationScope(FALSE)->addCreateOnClick();
}
示例3: configure
public function configure(Form $form)
{
$_this = $this;
$route = $form->addOne('route');
$group = $form->addGroup();
$route->setCurrentGroup($group);
$form->addText('name', 'Name');
$form->addText('price', 'Price')->setDefaultValue(0)->addCondition($form::FILLED)->addRule($form::FLOAT);
$form->addText('rrp', 'RRP')->addCondition($form::FILLED)->addRule($form::FLOAT);
$route->addTextArea('notation', 'Description');
$route->addFileEntityInput('photo', 'Image');
$form->addText('inStock', 'In stock')->addCondition($form::FILLED)->addRule($form::FLOAT);
$form->addGroup('');
$form->addManyToOne('category', 'Main category');
$form->addManyToMany('categories', 'Next categories');
$form->addGroup();
$form->addManyToMany('labels', 'Labels');
$tags = $form->addContainer('tags');
$tags->setCurrentGroup($group = $form->addGroup());
$form->addGroup('Types');
$form->addTags('typesAsArray', 'Types')->setSuggestCallback(function () use($_this, $form) {
$ret = array();
foreach ($_this->getTagsFromCategories($form) as $tag) {
$ret[$tag] = $tag;
}
return $ret;
})->setDelimiter('[;]+')->setJoiner(';');
$form->addGroup();
$form->addSaveButton('Save');
}
示例4: configure
public function configure(Form $form)
{
$group = $form->addGroup();
$form->addText('name', 'Name');
$form->addOne('route')->setCurrentGroup($group)->addTextArea('notation', 'Notation', NULL, 4)->getControlPrototype()->attrs['class'] = 'input-block-level';
$form->addSaveButton('Save');
}
示例5: configure
public function configure(Form $form)
{
$group = $form->addGroup();
$form->addText('name', 'Name');
$form->addOne('route')->setCurrentGroup($group)->addTextArea('notation', 'Notation', NULL, 4)->getControlPrototype()->attrs['class'] = 'input-block-level';
$form->addManyToOne('linkedRoute', 'Linked route')->setCriteria(array('page' => $form->data->extendedPage->linkedPage->id));
$form->addSaveButton('Save');
}
示例6: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$route = $form->addOne('conditions')->addOne('route');
$route->setCurrentGroup($form->addGroup()->setOption('class', 'full'));
$route->addContentEditor('text', NULL, NULL, 30)->getControlPrototype()->class[] = 'input-block-level';
$route['text']->getControlPrototype()->data['cms-route'] = $form->data->page->mainRoute->id;
$route['text']->getControlPrototype()->data['cms-page'] = $form->data->page->id;
$form->addSaveButton('Save');
}
示例7: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$page = $form->addOne('page');
$mainRoute = $page->addOne('mainRoute');
$mainRoute->setCurrentGroup($form->addGroup());
$mainRoute->addCheckbox('published', 'Publish');
$mainRoute->addDateTime('released', 'Release')->addRule($form::FILLED);
$mainRoute->addDateTime('expired', 'Expire');
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例8: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$route = $form->addOne('route');
$group = $form->addGroup();
$form->addText('name', 'Name');
$route->setCurrentGroup($group);
$route->addTextArea('notation', 'Notation');
$form->addManyToOne('parent', 'Parent');
$route->addFileEntityInput('photo', 'Photo');
$form->addGroup();
$form->addSaveButton('Save');
}
示例9: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$form->addGroup();
$user = $form->addOne('user');
$user->addMany('loginProviders', function (\Venne\Forms\Container $container) use($form) {
$container->setCurrentGroup($form->addGroup($container->data->type));
$container->addSelect('type', 'Type')->setItems($this->securityManager->getLoginProviders(), false);
$container->addText('uid', 'UID');
$container->addSubmit('remove', 'Remove')->addRemoveOnClick();
});
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例10: configure
public function configure(Form $form)
{
$route = $form->addOne('route');
$group = $form->addGroup();
$form->addText('name', 'Name');
$route->setCurrentGroup($group);
$route->addTextArea('description', 'Description')->getControlPrototype()->attrs['class'] = 'input-block-level';
$route->addFileEntityInput('photo', 'Photo');
$form->addManyToOne('parent', 'Parent');
//$form->addManyToMany('types', 'Types');
$form->addTags('typesAsArray', 'Types')->setDelimiter('[;]+')->setJoiner(';');
$form->addSaveButton('Save');
}
示例11: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$route = $form->addOne('route');
$form->addGroup();
$form->addManyToOne('parent', 'Parent');
$group = $form->addGroup('Author');
$authorName = $form->addText('author', 'Name');
$route->setCurrentGroup($group);
$author = $route->addManyToOne('author', 'Author');
$authorName->addConditionOn($author, $form::FILLED)->addRule($form::EQUAL, '')->elseCondition()->addRule($form::FILLED);
$author->addConditionOn($authorName, $form::FILLED)->addRule($form::EQUAL, '')->elseCondition()->addRule($form::FILLED);
$form->addGroup('Text');
$form->addTextArea('text', 'Text')->setRequired(TRUE)->getControlPrototype()->attrs['class'][] = 'span12';
$form->addSaveButton('Save');
}
示例12: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addOne('page')->setCurrentGroup($form->addGroup('General'))->addCheckbox($this->getSecuredColumnName(), 'Enable permissions');
if ($form->data->page->{$this->getSecuredColumnName()}) {
$permissions = $form->addContainer('permissions');
foreach ($this->getPrivileges($form) as $key => $name) {
$container = $permissions->addContainer($key);
$container->setCurrentGroup($form->addGroup(ucfirst($name)));
$container->addCheckbox('all', 'Allow for all')->addCondition($form::EQUAL, FALSE)->toggle($container->name . $key);
$group = $form->addGroup()->setOption('id', $container->name . $key);
$container->setCurrentGroup($group);
$container->addMultiSelect('permissions', 'Roles', $this->getRoles());
}
}
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例13: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$route = $form->addOne('route');
$group = $form->addGroup();
$form->addText('name', 'Name');
$route->setCurrentGroup($group);
$route->addFileEntityInput('photo', 'Photo');
$route->addManyToOne('author', 'Author')->setDisabled(TRUE);
$route->addDateTime('released', 'Release date')->addRule($form::FILLED);
$route->addDateTime('expired', 'Expiry date');
$route->addTextArea('notation', 'Notation');
$form->addGroup('Event settings');
$form->addDateTime('date', 'Date')->addRule($form::FILLED);
$route->setCurrentGroup($form->addGroup('Content'));
$route->addContentEditor('text', NULL, NULL, 20);
$form->addSaveButton('Save');
}
示例14: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$user = $form->addOne('user');
$group = $form->addGroup();
$user->setCurrentGroup($group);
$user->addText('name', 'Name');
$user->addTextArea('notation', 'Notation', 40, 4)->getControlPrototype()->attrs['class'] = 'input-block-level';
$route = $user->addOne('route');
$route->setCurrentGroup($group);
$route->addFileEntityInput('photo', 'Avatar');
$user->setCurrentGroup($form->addGroup('Password'));
$user->addCheckbox('password_new', 'Change password')->addCondition($form::EQUAL, TRUE)->toggle('setPasswd');
$user->setCurrentGroup($form->addGroup()->setOption('id', 'setPasswd'));
$user->addPassword('password', 'Password')->setOption('description', 'minimal length is 5 char')->addConditionOn($user['password_new'], Form::FILLED)->addRule(Form::FILLED, 'Enter password')->addRule(Form::MIN_LENGTH, 'Password is short', 5);
$user->addPassword('password_confirm', 'Confirm password')->addConditionOn($user['password_new'], Form::FILLED)->addRule(Form::EQUAL, 'Invalid re password', $user['password']);
$user->setCurrentGroup($form->addGroup());
}
示例15: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$group = $form->addGroup();
$form->addText('subject', 'Subject');
$sender = $form->addOne('sender');
$sender->setCurrentGroup($group);
$sender->addManyToOne('user', 'Sender');
$recipients = $form->addMany('recipients', function ($container) use($group) {
$container->setCurrentGroup($group);
$container->addManyToOne('user', 'Recipient');
$container->addSubmit('remove', 'Smazat')->addRemoveOnClick();
});
$recipients->setCurrentGroup($group);
$recipients->addSubmit('add', 'Add')->addCreateOnClick();
$form->addGroup('Text');
$form->addTextArea('text');
$form->setCurrentGroup();
$form->addSaveButton('Save');
}