/**
  * Renders 'label' part of visual row of controls.
  * @param  IFormControl
  * @return string
  */
 public function renderLabel(IFormControl $control)
 {
     $head = $this->getWrapper('label container');
     if ($control instanceof Checkbox || $control instanceof Button) {
         return $head->setHtml(' ');
     } else {
         return $head->setHtml((string) $control->getLabel() . $this->getValue('label suffix'));
     }
 }
Пример #2
0
 /**
  * Renders 'label' part of visual row of controls.
  * @param  IFormControl
  * @return string
  */
 public function renderLabel(IFormControl $control)
 {
     $head = $this->getWrapper('label container');
     if ($control instanceof Checkbox || $control instanceof Button) {
         return $head->setHtml($head->getName() === 'td' || $head->getName() === 'th' ? ' ' : '');
     } else {
         $label = $control->getLabel();
         $suffix = $this->getValue('label suffix') . ($control->getOption('required') ? $this->getValue('label requiredsuffix') : '');
         if ($label instanceof Html) {
             $label->setHtml($label->getHtml() . $suffix);
             $suffix = '';
         }
         return $head->setHtml((string) $label . $suffix);
     }
 }
 private static function dumpControlError(IFormControl $control)
 {
     if (!$control->hasError()) {
         return '';
     }
     if ($control instanceof FormControlSet && $control->hasError(FormControlError::WRONG)) {
         $message = '<ul>';
         foreach ($control as $innerControl) {
             $message .= self::dumpControlError($innerControl);
         }
         $message .= '</ul>';
     } else {
         $message = $control->getErrorMessage();
     }
     return '<li>' . $control->getName() . (($label = $control->getLabel()) ? " ({$label})" : '') . ' is ' . $control->getError() . ': <i>' . $message . '</i></li>';
 }