当前位置: 首页>>代码示例>>PHP>>正文


PHP Form::addDynamic方法代码示例

本文整理汇总了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');
 }
开发者ID:svobodni,项目名称:web,代码行数:33,代码来源:SystemRegistrationFormFactory.php

示例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');
 }
开发者ID:svobodni,项目名称:web,代码行数:25,代码来源:ToolbarFormFactory.php


注:本文中的Venne\Forms\Form::addDynamic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。