本文整理汇总了PHP中Venne\Forms\Form::addMany方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addMany方法的具体用法?PHP Form::addMany怎么用?PHP Form::addMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Venne\Forms\Form
的用法示例。
在下文中一共展示了Form::addMany方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$entity = $form->data;
$form->addGroup('Supplier');
$form->addManyToOne('supplier', 'person')->addRule($form::FILLED);
$form->addGroup('Customer');
$form->addManyToOne('customer', 'person')->addRule($form::FILLED);
$form->addGroup('Billing information');
$form->addText('identification', 'Identification');
$form->addText('amount', 'Amount')->addRule($form::FILLED)->addRule($form::FLOAT);
$form->addManyToOne('payment', 'Payment');
$form->addSelect('type', 'Type')->setItems(InvoiceEntity::getTypes());
$form->addSelect('state', 'State')->setItems(InvoiceEntity::getStates());
$form->addText('constantSymbol', 'Constant sb.');
$form->addText('variableSymbol', 'Variable sb.');
$form->addText('specificSymbol', 'Specific sb.');
$group = $form->addGroup('Items');
$recipients = $form->addMany('items', function (Container $container) use($group, $form) {
$container->setCurrentGroup($group);
$container->addText('name', 'Name')->addRule($form::FILLED);
$container->addText('unitValue', 'Unit value')->addRule($form::FILLED)->addRule($form::FLOAT);
$container->addText('units', 'Units')->addRule($form::FILLED)->addRule($form::INTEGER);
$container->addText('qUnit', 'Quantity unit')->addRule($form::FILLED);
$container->addText('tax', 'Tax')->addRule($form::FLOAT);
$container->addCheckbox('unitValueIsTaxed', 'Value is taxed');
$container->addSubmit('remove', 'Remove')->addRemoveOnClick();
}, function () use($entity) {
return new ItemEntity($entity);
});
$recipients->setCurrentGroup($group);
$recipients->addSubmit('add', 'Add item')->addCreateOnClick();
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例2: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addGroup();
$form->addText('name', 'Name');
$form->addText('localUrl', 'URL');
$form->addText('title', 'Title');
$form->addText('keywords', 'Keywords');
$form->addText('description', 'Description');
$form->addManyToOne('author', 'Author');
$form->addSelect('robots', 'Robots')->setItems(RouteEntity::getRobotsValues(), FALSE);
$form->addSelect('changefreq', 'Change frequency')->setItems(RouteEntity::getChangefreqValues(), FALSE)->setPrompt('-------');
$form->addSelect('priority', 'Priority')->setItems(RouteEntity::getPriorityValues(), FALSE)->setPrompt('-------');
// layout
$form->setCurrentGroup($form->addGroup());
$form->addCheckbox('copyLayoutFromParent', 'Layout from parent');
$form['copyLayoutFromParent']->addCondition($form::EQUAL, FALSE)->toggle('group-layout_' . $form->data->id);
$form->setCurrentGroup($form->getForm()->addGroup()->setOption('id', 'group-layout_' . $form->data->id));
$form->addManyToOne('layout', 'Layout');
$form->setCurrentGroup($form->addGroup());
$form->addCheckbox('copyLayoutToChildren', 'Share layout with children');
$form['copyLayoutToChildren']->addCondition($form::EQUAL, FALSE)->toggle('group-layout2_' . $form->data->id);
$form->setCurrentGroup($form->getForm()->addGroup()->setOption('id', 'group-layout2_' . $form->data->id));
$form->addManyToOne('childrenLayout', 'Share new layout');
// cache
$form->setCurrentGroup($form->addGroup());
$form->addCheckbox('copyCacheModeFromParent', 'Cache mode from parent');
$form['copyCacheModeFromParent']->addCondition($form::EQUAL, FALSE)->toggle('group-cache_' . $form->data->id);
$form->setCurrentGroup($form->getForm()->addGroup()->setOption('id', 'group-cache_' . $form->data->id));
$form->addSelect('cacheMode', 'Cache strategy')->setItems(\CmsModule\Content\Entities\RouteEntity::getCacheModes(), FALSE)->setPrompt('off');
$form->setCurrentGroup($form->addGroup());
$form->addFileEntityInput('photo', 'Photo');
$form->addTextArea('notation', 'Notation');
$form->addTextArea('text', 'Text');
$form->addGroup('Dates');
$form->addDateTime('created', 'Created')->setDisabled(TRUE);
$form->addDateTime('updated', 'Updated')->setDisabled(TRUE);
$form->addDateTime('released', 'Released')->addRule($form::FILLED);
$form->addDateTime('expired', 'Expired');
$form->addGroup('Tags');
$form->addContentTags('tags');
$aliases = $form->addMany('aliases', function (\Venne\Forms\Container $container) use($form) {
$container->setCurrentGroup($form->addGroup('URL alias'));
$container->addText('aliasUrl', 'Url')->setRequired();
$container->addText('aliasLang', 'Language alias');
$container->addText('aliasDomain', 'Domain url');
$container->addSubmit('remove', 'Remove alias')->addRemoveOnClick();
});
$aliases->addSubmit('add', 'Add alias')->addCreateOnClick();
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例3: 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');
}
示例4: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$extendedRoute = $form->data;
$form->addGroup('Settings');
$form->addText('subject', 'Předmět')->addRule($form::FILLED);
$box = $form->addMany('boxes', function (Container $box) use($form) {
$box->setCurrentGroup($form->addGroup('Box'));
$box->addText('name', 'Nadpis');
$box->addTextArea('text', 'text');
$box->addFileEntityInput('photo', 'Photo');
$box->addSubmit('remove', 'Smazat box')->addRemoveOnClick();
}, function () use($extendedRoute) {
return new BoxEntity($extendedRoute);
});
$box->addSubmit('add', 'Přidat box')->addCreateOnClick();
// metodu vytváří replicator
$form->addGroup();
$form->addManyToMany('events', 'Events');
$form->addManyToMany('blogs', 'Blogs');
$form->addSaveButton('Save');
}