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


PHP Container::getForm方法代码示例

本文整理汇总了PHP中Nette\Forms\Container::getForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getForm方法的具体用法?PHP Container::getForm怎么用?PHP Container::getForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Forms\Container的用法示例。


在下文中一共展示了Container::getForm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(Nette\Forms\Container $container, EntityFormMapper $mapper, ControlFactory $controlFactory = NULL, EntityManager $em = NULL)
 {
     $this->container = $container;
     $this->mapper = $mapper;
     $this->em = $em ?: $mapper->getEntityManager();
     $this->controlFactory = $controlFactory ?: new ControlFactory();
     /** @var Nette\Application\UI\Form|Kdyby\DoctrineForms\EntityForm $form */
     if (method_exists($form = $container->getForm(FALSE), 'injectEntityMapper')) {
         $form->injectEntityMapper($this->mapper);
     }
 }
开发者ID:kuba1999,项目名称:DoctrineForms,代码行数:11,代码来源:EntityBuilder.php

示例2: findControl

 /**
  * @param Container $container
  * @param ConstraintViolationInterface $violation
  * @return Nette\Forms\IControl|Nette\Forms\Controls\BaseControl|UI\Form
  */
 private function findControl(Container $container, ConstraintViolationInterface $violation)
 {
     if (!($m = Nette\Utils\Strings::split('.' . $violation->getPropertyPath(), '~([\\.\\[])~'))) {
         return $container->getForm();
         // apply the error to form
     }
     $control = $container;
     while (($type = array_shift($m)) !== NULL && $control) {
         if (empty($type)) {
             continue;
         }
         $step = array_shift($m);
         if ($type === '[') {
             $step = substr($step, 0, -1);
         }
         $control = $control->getComponent($step, FALSE);
     }
     return $control instanceof Nette\Forms\IControl ? $control : $container->getForm();
 }
开发者ID:kuba1999,项目名称:DoctrineForms,代码行数:24,代码来源:ConstraintViolationsMapper.php

示例3: getControlGroup

 /**
  * @param Forms\Container $container
  * @param IGroupConfig    $groupConfig
  * @return Forms\ControlGroup
  */
 private static function getControlGroup(Forms\Container $container, IGroupConfig $groupConfig)
 {
     $form = $container->getForm();
     $group = $form->getGroup($groupConfig->getLabel());
     if ($group === NULL) {
         // Create group
         $group = $form->addGroup($groupConfig->getLabel(), FALSE);
         foreach ($groupConfig->getOptions() as $key => $value) {
             $group->setOption($key, $value);
         }
     }
     return $group;
 }
开发者ID:mike227,项目名称:n-forms,代码行数:18,代码来源:ContainerBuilder.php

示例4: validate

 protected function validate()
 {
     $this->mapper->runValidation(function (ValidatorInterface $validatorInterface) {
         return $validatorInterface->validatePropertyValue($this->wrappedEntity->getEntity(), $this->component->name, $this->collection);
     }, $this->component instanceof BaseControl ? $this->component : $this->component->getForm());
 }
开发者ID:librette,项目名称:doctrine-forms,代码行数:6,代码来源:ToManySaveHelper.php

示例5: findControl

 /**
  * @param Container $container
  * @param ConstraintViolationInterface $violation
  * @return Nette\Forms\IControl|Nette\Forms\Controls\BaseControl|Nette\Application\UI\Form
  */
 protected function findControl(Container $container, ConstraintViolationInterface $violation)
 {
     // propertyPath eg. addresses[1].street
     $path = preg_split('/\\]\\.|\\.|\\[|\\]/', $violation->getPropertyPath(), -1, PREG_SPLIT_NO_EMPTY);
     $control = $container;
     while (($step = array_shift($path)) !== NULL && $control) {
         $control = $control->getComponent($step, FALSE);
     }
     return $control instanceof Nette\Forms\IControl || $control instanceof IContainer ? $control : $container->getForm();
 }
开发者ID:mike227,项目名称:n-forms,代码行数:15,代码来源:ViolationsMapper.php


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