Exemplo n.º 1
0
 public function testToOptionArray()
 {
     $allOptions = [['types' => [['disabled' => false, 'label' => 'typeLabel', 'name' => 'typeName']], 'label' => 'optionLabel'], ['types' => [['disabled' => true]], 'label' => 'optionLabelDisabled']];
     $expect = [['value' => '', 'label' => __('-- Please select --')], ['label' => 'optionLabel', 'optgroup-name' => 'optionLabel', 'value' => [['label' => 'typeLabel', 'value' => 'typeName']]]];
     $this->productOptionConfig->expects($this->any())->method('getAll')->will($this->returnValue($allOptions));
     $this->assertEquals($expect, $this->model->toOptionArray());
 }
Exemplo n.º 2
0
 /**
  * @return mixed
  */
 public function getTypeSelectHtml()
 {
     $select = $this->getLayout()->createBlock('Magento\\Framework\\View\\Element\\Html\\Select')->setData(['id' => $this->getFieldId() . '_<%- data.id %>_type', 'class' => 'select select-product-option-type required-option-select'])->setName($this->getFieldName() . '[<%- data.id %>][type]')->setOptions($this->_optionType->toOptionArray());
     return $select->getHtml();
 }