/** * Render block HTML * * @return string */ protected function _toHtml() { if (!$this->getOptions()) { $this->setOptions($this->countryHelper->getCountries()); } return parent::_toHtml(); }
/** * Add necessary options * * @return \Magento\Framework\View\Element\AbstractBlock */ protected function _beforeToHtml() { if (!$this->getOptions()) { $layoutMergeParams = ['theme' => $this->_getThemeInstance($this->getTheme())]; /** @var $layoutProcessor \Magento\Framework\View\Layout\ProcessorInterface */ $layoutProcessor = $this->_layoutProcessorFactory->create($layoutMergeParams); $layoutProcessor->addPageHandles([$this->getLayoutHandle()]); $layoutProcessor->addPageHandles(['default']); $layoutProcessor->load(); $pageLayoutProcessor = $this->_layoutProcessorFactory->create($layoutMergeParams); $pageLayoutProcessor->addHandle($layoutProcessor->getPageLayout()); $pageLayoutProcessor->load(); $containers = array_merge($pageLayoutProcessor->getContainers(), $layoutProcessor->getContainers()); if ($this->getAllowedContainers()) { foreach (array_keys($containers) as $containerName) { if (!in_array($containerName, $this->getAllowedContainers())) { unset($containers[$containerName]); } } } asort($containers, SORT_STRING); $this->addOption('', __('-- Please Select --')); foreach ($containers as $containerName => $containerLabel) { $this->addOption($containerName, $containerLabel); } } return parent::_beforeToHtml(); }
public function _toHtml() { if (!$this->getOptions()) { foreach ($this->_getTemplates() as $template) { $this->addOption($template['value'], $template['label']); } } return parent::_toHtml(); }
/** * Render block HTML * * @return string */ protected function _toHtml() { if (!$this->getOptions()) { $this->setOptions($this->ccTypeHelper->getCcTypes()); } $this->setClass('cc-type-select'); $this->setExtraParams('multiple="multiple"'); return parent::_toHtml(); }
/** * Add necessary options * * @return \Magento\Framework\View\Element\AbstractBlock */ protected function _beforeToHtml() { if (!$this->getOptions()) { $this->addOption('', __('-- Please Select --')); $pageTypes = $this->_config->getPageTypes(); $this->_addPageTypeOptions($pageTypes); } return parent::_beforeToHtml(); }
/** * Render block HTML * * @return string */ public function _toHtml() { if (!$this->getOptions()) { foreach ($this->_metaSources as $groupId => $groupLabel) { $this->addOption($groupId, addslashes($groupLabel)); } } return parent::_toHtml(); }
/** * Add necessary options * * @return \Magento\Framework\View\Element\AbstractBlock */ protected function _beforeToHtml() { if (!$this->getOptions()) { $this->addOption('', __('-- Please Select --')); $layoutUpdateParams = array('theme' => $this->_getThemeInstance($this->getTheme())); $designAbstractions = $this->_appState->emulateAreaCode('frontend', array($this->_getLayoutProcessor($layoutUpdateParams), 'getAllDesignAbstractions')); $this->_addDesignAbstractionOptions($designAbstractions); } return parent::_beforeToHtml(); }
/** * Render block HTML * * @return string */ public function _toHtml() { if (!$this->getOptions()) { foreach ($this->_getCountries() as $country) { if (isset($country['value']) && $country['value'] && isset($country['label']) && $country['label']) { $this->addOption($country['value'], $country['label']); } } } return parent::_toHtml(); }
/** * Render block HTML * * @return string */ public function _toHtml() { if (!$this->getOptions()) { foreach ($this->_getCcTypes() as $country) { if (isset($country['value']) && $country['value'] && isset($country['label']) && $country['label']) { $this->addOption($country['value'], $country['label']); } } } $this->setExtraParams('multiple="multiple" style="height:80px;"'); return parent::_toHtml(); }
public function testGetHtmlJs() { $selectId = 'testId'; $selectClass = 'testClass'; $selectTitle = 'testTitle'; $selectName = 'testName'; $options = ['testValue' => 'testLabel', 'selectedValue' => 'selectedLabel']; $selectedValue = 'selectedValue'; $this->select->setId($selectId); $this->select->setClass($selectClass); $this->select->setTitle($selectTitle); $this->select->setName($selectName); $this->select->setOptions($options); $this->select->setValue($selectedValue); $result = '<select name="testName" id="testId" class="testClass" title="testTitle" >' . '<option value="testValue" #{option_extra_attr_4016862802} >testLabel</option>' . '<option value="selectedValue" selected="selected" #{option_extra_attr_662265145} >selectedLabel</option>' . '</select>'; $this->select->setIsRenderToJsTemplate(true); $this->assertEquals($result, $this->select->getHtml()); }
/** * Return output in one line. * * @return string */ public function _toHtml() { return trim(preg_replace('/\\s+/', ' ', parent::_toHtml())); }
/** * Render block HTML * * @return string */ public function _toHtml() { if (!$this->getOptions()) { if ($this->_addGroupAllOption) { $this->addOption($this->groupManagement->getAllCustomersGroup()->getId(), __('ALL GROUPS')); } foreach ($this->_getCustomerGroups() as $groupId => $groupLabel) { $this->addOption($groupId, addslashes($groupLabel)); } } return parent::_toHtml(); }
protected function _toHtml() { $this->setName($this->getInputName()); $this->setClass('select'); return trim(preg_replace('/\\s+/', ' ', parent::_toHtml())); }
/** * Render block HTML * * @return string */ public function _toHtml() { if (!$this->getOptions()) { if ($this->_addGroupAllOption) { $this->addOption(\Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL, __('ALL GROUPS')); } foreach ($this->_getCustomerGroups() as $groupId => $groupLabel) { $this->addOption($groupId, addslashes($groupLabel)); } } return parent::_toHtml(); }