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


PHP FormControl::getControl方法代码示例

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


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

示例1: getControl

 public function getControl()
 {
     $control = parent::getControl();
     foreach ($this->getRules() as $rule) {
         if ($rule->type === Rule::VALIDATOR && !$rule->isNegative && ($rule->operation === Form::LENGTH || $rule->operation === Form::MAX_LENGTH)) {
             $control->maxlength = is_array($rule->arg) ? $rule->arg[1] : $rule->arg;
         }
     }
     if ($this->emptyValue !== '') {
         $control->data('nette-empty-value', $this->translate($this->emptyValue));
     }
     return $control;
 }
开发者ID:riskatlas,项目名称:micka,代码行数:13,代码来源:TextBase.php

示例2: getControl

 /**
  * Generates control's HTML element.
  * @return Html
  */
 public function getControl()
 {
     $control = FormControl::getControl();
     // skopirovany kod z SelectBox.php
     if ($this->isFirstSkipped()) {
         $items = $this->items;
         reset($items);
         $control->data['nette-empty-value'] = $this->areKeysUsed() ? key($items) : current($items);
     }
     $selected = $this->getValue();
     $this->selected = is_array($selected) ? array_flip($selected) : array($selected => TRUE);
     $this->formatOptions($this->items, $control);
     return $control;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:18,代码来源:MySelectBox.php

示例3: getControl

 /**
  * Generates control's HTML element.
  * @param  mixed
  * @return Html
  */
 public function getControl($key = NULL)
 {
     if ($key === NULL) {
         $container = clone $this->container;
         $separator = (string) $this->separator;
     } elseif (!isset($this->items[$key])) {
         return NULL;
     }
     $control = parent::getControl();
     $id = $control->id;
     $counter = -1;
     $value = $this->value === NULL ? NULL : (string) $this->getValue();
     $label = Html::el('label');
     foreach ($this->items as $k => $val) {
         $counter++;
         if ($key !== NULL && $key != $k) {
             continue;
         }
         // intentionally ==
         $control->id = $label->for = $id . '-' . $counter;
         $control->checked = (string) $k === $value;
         $control->value = $k;
         if ($val instanceof Html) {
             $label->setHtml($val);
         } else {
             $label->setText($this->translate($val));
         }
         if ($key !== NULL) {
             return (string) $control . (string) $label;
         }
         $container->add((string) $control . (string) $label . $separator);
         unset($control->data['nette-rules']);
         // TODO: separator after last item?
     }
     return $container;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:41,代码来源:RadioList.php

示例4: getControl

 /**
  * Generates control's HTML element.
  * @return Nette\Web\Html
  */
 public function getControl()
 {
     $control = parent::getControl();
     $control->value = $this->translate($this->caption);
     return $control;
 }
开发者ID:vrana,项目名称:nette,代码行数:10,代码来源:Button.php

示例5: getControl

 /**
  * Generates control's HTML element.
  * @return Nette\Web\Html
  */
 public function getControl()
 {
     return parent::getControl()->checked($this->value);
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:8,代码来源:Checkbox.php

示例6: getControl

 /**
  * Generates control's HTML element.
  * @return Html
  */
 public function getControl()
 {
     return parent::getControl()->value($this->forcedValue === NULL ? $this->value : $this->forcedValue);
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:8,代码来源:HiddenField.php

示例7: getControl

 /**
  * Generates control's HTML element.
  * @return Nette\Web\Html
  */
 public function getControl()
 {
     $container = clone $this->container;
     $separator = (string) $this->separator;
     $control = parent::getControl();
     $id = $control->id;
     $counter = 0;
     $value = $this->value === NULL ? NULL : (string) $this->getValue();
     $label = Html::el('label');
     foreach ($this->items as $key => $val) {
         $control->id = $label->for = $id . '-' . $counter;
         $control->checked = (string) $key === $value;
         $control->value = $key;
         if ($val instanceof Html) {
             $label->setHtml($val);
         } else {
             $label->setText($this->translate($val));
         }
         $container->add((string) $control . (string) $label . $separator);
         $counter++;
         // TODO: separator after last item?
     }
     return $container;
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:28,代码来源:RadioList.php

示例8: getControl

 /**
  * Generates control's HTML element.
  * @return Html
  */
 public function getControl()
 {
     $control = parent::getControl();
     $selected = $this->getValue();
     $selected = is_array($selected) ? array_flip($selected) : array($selected => TRUE);
     $option = Html::el('option');
     foreach ($this->items as $key => $value) {
         if (!is_array($value)) {
             $value = array($key => $value);
             $dest = $control;
         } else {
             $dest = $control->create('optgroup')->label($key);
         }
         foreach ($value as $key2 => $value2) {
             if ($value2 instanceof Html) {
                 $dest->add((string) $value2->selected(isset($selected[$key2])));
             } elseif ($this->useKeys) {
                 $dest->add((string) $option->value($key2)->selected(isset($selected[$key2]))->setText($this->translate($value2)));
             } else {
                 $dest->add((string) $option->selected(isset($selected[$value2]))->setText($this->translate($value2)));
             }
         }
     }
     return $control;
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:29,代码来源:SelectBox.php

示例9: getControl

 public function getControl()
 {
     return parent::getControl()->data('nette-empty-value', $this->emptyValue === '' ? NULL : $this->translate($this->emptyValue));
 }
开发者ID:radypala,项目名称:maga-website,代码行数:4,代码来源:TextBase.php

示例10: getControl

 /**
  * Generates control's HTML element.
  * @return Html
  */
 public function getControl()
 {
     return parent::getControl()->value($this->forcedValue === NULL ? $this->value : $this->forcedValue)->data('nette-rules', NULL);
 }
开发者ID:riskatlas,项目名称:micka,代码行数:8,代码来源:HiddenField.php


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