Exemplo n.º 1
0
 private function renderWidgetList($value, $choices, $attributes)
 {
     $name = $this->getAttribute('name');
     $flags = $this->getAttribute('flags');
     $hiddenWidget = new Hidden($this->view);
     $hiddenWidget->setAttribute('flags', $flags)->setAttribute('value', '')->setAttribute('class', 'Hidden')->setAttribute('name', $name);
     $contentWidget = new Literal($this->view);
     $contentWidget->setAttribute('data', $this->generateSelectorContentWidgetList($name, $value, $choices, $flags));
     $panelWidget = new Panel($this->view);
     $panelWidget->setAttribute('class', $attributes['class'])->setAttribute('name', $name)->insert($hiddenWidget)->insert($contentWidget);
     if ($this->getAttribute('flags') & \Nethgui\Renderer\WidgetFactoryInterface::LABEL_NONE) {
         return $panelWidget->renderContent();
     }
     $fieldsetWidget = new Fieldset($this->view);
     $fieldsetWidget->setAttribute('template', $this->getAttribute('label', $this->getTranslateClosure($name . '_label')))->setAttribute('flags', $this->getAttribute('flags'));
     if ($this->hasAttribute('icon-before')) {
         $fieldsetWidget->setAttribute('icon-before', $this->getAttribute('icon-before'));
     }
     $fieldsetWidget->insert($panelWidget);
     return $fieldsetWidget->renderContent();
 }
Exemplo n.º 2
0
 protected function renderContent()
 {
     $this->initializeRendering();
     $content = '';
     $content .= $this->openTag('div', array('class' => 'ObjectPicker ' . implode(' ', $this->metadata['listenToEvents'])));
     // render the an hidden input, as fallback empty post value:
     foreach ($this->getChildren() as $child) {
         $content .= $this->selfClosingTag('input', array('type' => 'hidden', 'value' => '', 'name' => $this->getControlName($child->getAttribute('name'))));
     }
     $content .= $this->renderMeta();
     $content .= $this->renderObjects();
     $content .= $this->closeTag('div');
     if ($this->hasAttribute('template')) {
         $fieldsetWidget = new Fieldset($this->view);
         $fieldsetWidget->setAttribute('template', $this->getAttribute('template'))->setAttribute('icon-before', $this->getAttribute('icon-before'))->insert($this->view->literal($content));
         return $fieldsetWidget;
     }
     return $content;
 }