Example #1
0
 /**
  * Render a description
  *
  * @param  string $content
  * @return string
  */
 public function render($content)
 {
     $element = $this->getElement();
     $separator = $this->getSeparator();
     $placement = $this->getPlacement();
     $class = $this->getClass();
     $value = $this->getValue();
     $name = $this->getName();
     $checked = $this->getChecked();
     $checkedName = $this->getCheckedName();
     $box = $checkedName == null || $element->isRequired() ? '' : "<input class=\"z-form-checkbox\" type = 'checkbox'  name = '{$checkedName}' {$checked} />Удалить<br />";
     if ($value) {
         $cropped = '';
         //$crop_options = $this->getOption('cropoptions');
         //var_dump($this->_options);
         if (count($this->_crop_options)) {
             $cropped = $this->renderCropped($this->_crop_options);
             //добавляем все функции обрезки
         }
         $hfield = "{$box}\n\t\t<input type = 'hidden' value = '{$value}' name = '{$name}' />\n\t\t\t<a target=\"_blank\" href = '" . $this->_file->getSiteName() . "'>" . $this->_file->getName() . "</a>" . "<br/>" . $cropped;
     } else {
         $hfield = '';
     }
     if ($hfield) {
         $hfield = '<div>' . $hfield . '</div>';
     }
     switch ($placement) {
         case self::PREPEND:
             return $hfield . $separator . $content;
         case self::APPEND:
         default:
             return $content . $separator . $hfield;
     }
 }