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


PHP IControl::getLabel方法代码示例

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


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

示例1: renderLabel

 /**
  * Renders 'label' part of visual row of controls.
  * @return string
  */
 public function renderLabel(Nette\Forms\IControl $control)
 {
     $head = $this->getWrapper('label container');
     if ($control instanceof Nette\Forms\Controls\Checkbox || $control instanceof Nette\Forms\Controls\Button) {
         return $head->setHtml($head->getName() === 'td' || $head->getName() === 'th' ? ' ' : '');
     } else {
         $label = $control->getLabel();
         $suffix = $this->getValue('label suffix') . ($control->isRequired() ? $this->getValue('label requiredsuffix') : '');
         if ($label instanceof Html) {
             $label->setHtml($label->getHtml() . $suffix);
             $suffix = '';
         }
         return $head->setHtml((string) $label . $suffix);
     }
 }
开发者ID:svobodni,项目名称:web,代码行数:19,代码来源:DefaultFormRenderer.php

示例2: renderLabel

 /**
  * Renders 'label' part of visual row of controls.
  * @return string
  */
 public function renderLabel(Nette\Forms\IControl $control)
 {
     $suffix = $this->getValue('label suffix') . ($control->isRequired() ? $this->getValue('label requiredsuffix') : '');
     $label = $control->getLabel();
     if ($label instanceof Html) {
         $label->add($suffix);
         if ($control->isRequired()) {
             $label->class($this->getValue('control .required'), TRUE);
         }
     } elseif ($label != NULL) {
         // @intentionally ==
         $label .= $suffix;
     }
     return $this->getWrapper('label container')->setHtml($label);
 }
开发者ID:luminousinfoways,项目名称:pccfoas,代码行数:19,代码来源:DefaultFormRenderer.php

示例3:

Nette\InvalidArgumentException("Argument must be array of IFormControl instances.");}$s[]=(string)$control->getControl();}$pair=$this->getWrapper('pair container');$pair->add($this->renderLabel($control));$pair->add($this->getWrapper('control container')->setHtml(implode(" ",$s)));return$pair->render(0);}function
renderLabel(Nette\Forms\IControl$control){$head=$this->getWrapper('label container');if($control
instanceof
Nette\Forms\Controls\Checkbox||$control
instanceof
Nette\Forms\Controls\Button){return$head->setHtml(($head->getName()==='td'||$head->getName()==='th')?' ':'');}else{$label=$control->getLabel();$suffix=$this->getValue('label suffix').($control->isRequired()?$this->getValue('label requiredsuffix'):'');if($label
instanceof
Html){$label->setHtml($label->getHtml().$suffix);$suffix='';}return$head->setHtml((string)$label.$suffix);}}function
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:8,代码来源:loader.php

示例4: renderLabel

 /**
  * Renders 'label' part of visual row of controls.
  * @param \Nette\Forms\IControl $control
  * @return string
  */
 public function renderLabel(\Nette\Forms\IControl $control)
 {
     if (!$control instanceof \Nette\Forms\Controls\Checkbox && !$control instanceof \Nette\Forms\Controls\Button) {
         if ($control->isRequired()) {
             $label = $control->getLabel();
             $caption = $label->getText();
             $required = \Nette\Utils\Html::el('small');
             $required->setText($this->requiredLabel);
             $label->setHtml($caption . " " . (string) $required);
             return $label;
         }
     }
     return parent::renderLabel($control);
 }
开发者ID:r-st,项目名称:foundation-form-renderer,代码行数:19,代码来源:Renderer.php

示例5: renderControl

 /**
  * Renders 'control' part of visual row of controls.
  * @param \Nette\Forms\IControl $control
  * @return string
  */
 public function renderControl(\Nette\Forms\IControl $control)
 {
     if ($control instanceof \Nette\Forms\Controls\Checkbox) {
         $html = $control->getLabel();
         $caption = $html->getText();
         $html->setHtml((string) $control->getControl() . " " . $caption);
         return (string) $html;
     }
     return parent::renderControl($control);
 }
开发者ID:frosty22,项目名称:foundation-form-renderer,代码行数:15,代码来源:Renderer.php

示例6: renderControl

 /**
  * Renders 'control' part of visual row of controls.
  * @return string
  */
 public function renderControl(Nette\Forms\IControl $control)
 {
     $body = $this->getWrapper('control container');
     if ($this->counter % 2) {
         $body->class($this->getValue('control .odd'), TRUE);
     }
     $description = $control->getOption('description');
     if ($description instanceof Html) {
         $description = ' ' . $description;
     } elseif (is_string($description)) {
         $description = ' ' . $this->getWrapper('control description')->setText($control->translate($description));
     } else {
         $description = '';
     }
     if ($control->isRequired()) {
         $description = $this->getValue('control requiredsuffix') . $description;
     }
     $el = $control->getControl();
     if ($el instanceof Html && $el->getName() === 'input') {
         $el->class($this->getValue("control .{$el->type}"), TRUE);
     }
     if ($control instanceof Nette\Forms\Controls\Checkbox) {
         $el = $control->getLabel()->insert(0, $el);
     }
     return $body->setHtml($el . $description . $this->renderErrors($control));
 }
开发者ID:jurasm2,项目名称:nette,代码行数:30,代码来源:DefaultFormRenderer.php


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