/** * @return string */ public function getControl() { $control = parent::getControl(); $checkboxes = $this->renderCheckboxes(); if ($this->required && !$checkboxes) { $control->addAttributes(['required' => TRUE]); } return $control . $checkboxes; }
public function getControl() { $control = Html::el(); if ($this->multi) { for ($i = 0; $i < 20; $i++) { $parent = parent::getControl(); $parent->name .= '-' . $i; $parent->onChange = 'if($(this).val()) { $("#' . $parent->id . '-' . ($i + 1) . '").parent().show(); }'; $parent->id .= '-' . $i; $control->add($d = Html::el('div')); $d->add($parent); if ($i > 0) { $d->style = 'display: none;'; } } } else { $control->add(parent::getControl()); } if ($this->fileEntity) { if ($this->multi) { $files = $this->fileEntity; } else { $files = array(); if ($this->fileEntity) { $files[] = $this->fileEntity; } } $div = $control->create('div', array('style' => 'margin: 5px 0;')); foreach ($files as $file) { $div2 = $div->create('div', array('style' => 'float: left; margin-right: 10px;', 'class' => 'caption')); $div2->create('img', array('src' => $file->getFileUrl(), 'style' => 'height: 64px; width: 64px;', 'class' => 'img-polaroid img-rounded')); $div2->create('br'); $div2->create('input', array('type' => 'checkbox', 'name' => $this->name . '_delete_' . $file->id)); $div2->create('span')->setText(' ' . ($this->translator ? $this->translator->translate('delete') : 'delete')); } } return $control; }
/** * @return string */ public function getControl() { $control = parent::getControl(); if ($this->required && !$this->checkbox->isOk()) { $control->addAttributes(['required' => TRUE]); } if ($this->checkbox->isOk()) { return $control . $this->checkbox->getControl($this->required); } return $control; }
/** * Generates control's HTML element. */ public function getControl() { $input = parent::getControl(); if ($this->path) { $this->template->pathName = $this->getHtmlName() . "-path"; $this->template->path = $this->path; $this->template->setFile(__DIR__ . "/templates/edit.latte"); } else { $this->template->setFile(__DIR__ . "/templates/add.latte"); } $this->template->removedName = $this->getHtmlName() . "-removed"; $this->template->input = $input; $this->template->_form = $this->getForm(); return Html::el()->add((string) $this->template); }
/** * @return mixed */ public function getControl() { $control = parent::getControl(); $control->addAttributes(['multiple' => TRUE]); return $control; }
public function getControl() { return parent::getControl()->multiple(TRUE); }
/** * @return string */ public function getControl() { if ($this->checkbox->isOk()) { return ($this->isRequired() ? parent::getControl() : NULL) . $this->checkbox->getControl(); } return parent::getControl(); }