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


PHP Form::getComponents方法代码示例

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


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

示例1: enable

 public function enable()
 {
     $this->validateScripts = array();
     $this->toggleScript = '';
     $this->central = TRUE;
     foreach ($this->form->getControls() as $control) {
         $script = $this->getValidateScript($control->getRules());
         if ($script) {
             $this->validateScripts[$control->getHtmlName()] = $script;
         }
         $this->toggleScript .= $this->getToggleScript($control->getRules());
         if ($control instanceof ISubmitterControl && $control->getValidationScope() !== TRUE) {
             $this->central = FALSE;
         }
     }
     if ($this->validateScripts || $this->toggleScript) {
         if ($this->central) {
             $this->form->getElementPrototype()->onsubmit("return nette.validateForm(this)", TRUE);
         } else {
             foreach ($this->form->getComponents(TRUE, 'Nette\\Forms\\ISubmitterControl') as $control) {
                 if ($control->getValidationScope()) {
                     $control->getControlPrototype()->onclick("return nette.validateForm(this)", TRUE);
                 }
             }
         }
     }
 }
开发者ID:vrana,项目名称:ORM-benchmark,代码行数:27,代码来源:InstantClientScript.php

示例2: renderFormEnd

 /**
  * Renders form end.
  *
  * @return string
  */
 public static function renderFormEnd(Form $form)
 {
     $s = '';
     if (strcasecmp($form->getMethod(), 'get') === 0) {
         $url = explode('?', $form->getElementPrototype()->action, 2);
         if (isset($url[1])) {
             foreach (preg_split('#[;&]#', $url[1]) as $param) {
                 $parts = explode('=', $param, 2);
                 $name = urldecode($parts[0]);
                 if (!isset($form[$name])) {
                     $s .= Nette\Utils\Html::el('input', array('type' => 'hidden', 'name' => $name, 'value' => urldecode($parts[1])));
                 }
             }
         }
     }
     foreach ($form->getComponents(true, 'Nette\\Forms\\Controls\\HiddenField') as $control) {
         if (!$control->getOption('rendered')) {
             $s .= $control->getControl();
         }
     }
     if (iterator_count($form->getComponents(true, 'Nette\\Forms\\Controls\\TextInput')) < 2) {
         $s .= '<!--[if IE]><input type=IEbug disabled style="display:none"><![endif]-->';
     }
     echo ($s ? "<div>{$s}</div>\n" : '') . $form->getElementPrototype()->endTag() . "\n";
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:30,代码来源:FormMacros.php

示例3: renderFormEnd

 /**
  * Renders form end.
  * @return string
  */
 public static function renderFormEnd(Form $form, $withTags = TRUE)
 {
     $s = '';
     if (strcasecmp($form->getMethod(), 'get') === 0) {
         foreach (preg_split('#[;&]#', parse_url($form->getElementPrototype()->action, PHP_URL_QUERY), NULL, PREG_SPLIT_NO_EMPTY) as $param) {
             $parts = explode('=', $param, 2);
             $name = urldecode($parts[0]);
             if (!isset($form[$name])) {
                 $s .= Html::el('input', ['type' => 'hidden', 'name' => $name, 'value' => urldecode($parts[1])]);
             }
         }
     }
     foreach ($form->getComponents(TRUE, Nette\Forms\Controls\HiddenField::class) as $control) {
         if (!$control->getOption('rendered')) {
             $s .= $control->getControl();
         }
     }
     if (iterator_count($form->getComponents(TRUE, Nette\Forms\Controls\TextInput::class)) < 2) {
         $s .= "<!--[if IE]><input type=IEbug disabled style=\"display:none\"><![endif]-->\n";
     }
     return $s . ($withTags ? $form->getElementPrototype()->endTag() . "\n" : '');
 }
开发者ID:richard-ejem,项目名称:forms,代码行数:26,代码来源:Runtime.php

示例4: renderEnd

 /**
  * Renders form end.
  * @return string
  */
 public function renderEnd()
 {
     $s = '';
     foreach ($this->form->getControls() as $control) {
         if ($control instanceof Nette\Forms\Controls\HiddenField && !$control->getOption('rendered')) {
             $s .= (string) $control->getControl();
         }
     }
     if (iterator_count($this->form->getComponents(TRUE, 'Nette\\Forms\\Controls\\TextInput')) < 2) {
         $s .= '<!--[if IE]><input type=IEbug disabled style="display:none"><![endif]-->';
     }
     if ($s) {
         $s = $this->getWrapper('hidden container')->setHtml($s) . "\n";
     }
     return $s . $this->form->getElementPrototype()->endTag() . "\n";
 }
开发者ID:svobodni,项目名称:web,代码行数:20,代码来源:DefaultFormRenderer.php

示例5: save

 /**
  * @param Form
  */
 public function save(Form $form)
 {
     $this->form = $form;
     $this->entities = [];
     $this->execute(function () {
         $this->entityManager->persist($this->entity);
     });
     $this->saveValues($this->applyOffset($form->getComponents(), $this->offset), $this->entity);
     if (!$form->isValid()) {
         return;
     }
     $this->getExecutionStrategy()->confirm();
     $valid = TRUE;
     foreach ($this->entities as $entity) {
         try {
             $this->runValidation(function (ValidatorInterface $validator) use($entity) {
                 return $validator->validate($entity);
             }, $form);
         } catch (ValidationException $e) {
             $valid = FALSE;
         }
     }
     if ($valid && $this->getAutoFlush()) {
         $this->flush();
     }
 }
开发者ID:librette,项目名称:doctrine-forms,代码行数:29,代码来源:Mapper.php

示例6: applyCallbacksToButtons

 /**
  * @param Forms\Form $form
  */
 private function applyCallbacksToButtons(Forms\Form $form)
 {
     /** @var SubmitButton $control */
     foreach ($form->getComponents(FALSE, 'Nette\\Forms\\Controls\\SubmitButton') as $control) {
         if (!in_array($control->getName(), array(self::FINISH_SUBMIT_NAME, self::NEXT_SUBMIT_NAME, self::PREV_SUBMIT_NAME))) {
             continue;
         }
         $control->onClick[] = array($this, 'submitStep');
         $control->onInvalidClick[] = array($this, 'submitStep');
         if ($control->getName() === self::PREV_SUBMIT_NAME) {
             $control->setValidationScope(FALSE);
         }
     }
 }
开发者ID:webchemistry,项目名称:forms-wizard,代码行数:17,代码来源:Wizard.php


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