Exemplo n.º 1
0
 /**
  * Prepare html output
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (!$this->getWidgetTemplates()) {
         $html = '<p class="nm"><small>' . __('Please Select Container First') . '</small></p>';
     } elseif (count($this->getWidgetTemplates()) == 1) {
         $widgetTemplate = current($this->getWidgetTemplates());
         $html = '<input type="hidden" name="template" value="' . $widgetTemplate['value'] . '" />';
         $html .= $widgetTemplate['label'];
     } else {
         $html = $this->getLayout()->createBlock('Magento\\Framework\\View\\Element\\Html\\Select')->setName('template')->setClass('select')->setOptions($this->getWidgetTemplates())->setValue($this->getSelected())->toHtml();
     }
     return parent::_toHtml() . $html;
 }
Exemplo n.º 2
0
 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $accordion = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Accordion')->setId($this->accordionBlockId);
     $accordion->addItem('samples', ['title' => __('Samples'), 'content' => $this->getLayout()->createBlock('Magento\\Downloadable\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Downloadable\\Samples')->toHtml(), 'open' => false]);
     $accordion->addItem('links', ['title' => __('Links'), 'content' => $this->getLayout()->createBlock('Magento\\Downloadable\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Downloadable\\Links', 'catalog.product.edit.tab.downloadable.links')->toHtml(), 'open' => true]);
     $this->setChild('accordion', $accordion);
     return parent::_toHtml();
 }