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


PHP Form::getMethod方法代码示例

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


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

示例1: renderBegin

 /**
  * Renders form begin.
  * @return string
  */
 public function renderBegin()
 {
     $this->counter = 0;
     foreach ($this->form->getControls() as $control) {
         $control->setOption('rendered', FALSE);
     }
     if (strcasecmp($this->form->getMethod(), 'get') === 0) {
         $el = clone $this->form->getElementPrototype();
         $url = explode('?', (string) $el->action, 2);
         $el->action = $url[0];
         $s = '';
         if (isset($url[1])) {
             foreach (preg_split('#[;&]#', $url[1]) as $param) {
                 $parts = explode('=', $param, 2);
                 $name = urldecode($parts[0]);
                 if (!isset($this->form[$name])) {
                     $s .= Html::el('input', array('type' => 'hidden', 'name' => $name, 'value' => urldecode($parts[1])));
                 }
             }
             $s = "\n\t" . $this->getWrapper('hidden container')->setHtml($s);
         }
         return $el->startTag() . $s;
     } else {
         return $this->form->getElementPrototype()->startTag();
     }
 }
开发者ID:svobodni,项目名称:web,代码行数:30,代码来源:DefaultFormRenderer.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])) {
             list($url[1]) = explode('#', $url[1], 2);
             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:genextwebs,项目名称:dropbox-sample,代码行数: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->getControls() as $control) {
         if ($control->getOption('type') === 'hidden' && !$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:MartinSadovy,项目名称:forms,代码行数:26,代码来源:Runtime.php

示例4: renderBegin

 /**
  * Renders form begin.
  * @return string
  */
 public function renderBegin()
 {
     $this->counter = 0;
     foreach ($this->form->getControls() as $control) {
         $control->setOption('rendered', FALSE);
     }
     if (strcasecmp($this->form->getMethod(), 'get') === 0) {
         $el = clone $this->form->getElementPrototype();
         $query = parse_url($el->action, PHP_URL_QUERY);
         $el->action = str_replace("?{$query}", '', $el->action);
         $s = '';
         foreach (preg_split('#[;&]#', $query, NULL, PREG_SPLIT_NO_EMPTY) as $param) {
             $parts = explode('=', $param, 2);
             $name = urldecode($parts[0]);
             if (!isset($this->form[$name])) {
                 $s .= Html::el('input', array('type' => 'hidden', 'name' => $name, 'value' => urldecode($parts[1])));
             }
         }
         return $el->startTag() . ($s ? "\n\t" . $this->getWrapper('hidden container')->setHtml($s) : '');
     } else {
         return $this->form->getElementPrototype()->startTag();
     }
 }
开发者ID:luminousinfoways,项目名称:pccfoas,代码行数:27,代码来源:DefaultFormRenderer.php


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