當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。