Example #1
0
 public function testGetTypes()
 {
     $label = 'someLabel';
     $value = 'someValue';
     $this->typeModel->expects($this->once())->method('toOptionArray')->will($this->returnValue([['label' => $label, 'value' => $value]]));
     $this->typeConverter->expects($this->once())->method('createDataFromModel')->will($this->returnValue($this->type));
     $this->assertEquals([$this->type], $this->model->getTypes());
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function getTypes()
 {
     $optionList = $this->type->toOptionArray();
     /** @var Type[] $typeDtoList */
     $typeDtoList = [];
     foreach ($optionList as $option) {
         $typeDtoList[] = $this->typeConverter->createDataFromModel($option);
     }
     return $typeDtoList;
 }
Example #3
0
 /**
  * @return mixed
  */
 public function getTypeSelectHtml()
 {
     $select = $this->getLayout()->createBlock('Magento\\Framework\\View\\Element\\Html\\Select')->setData(array('id' => $this->getFieldId() . '_{{index}}_type', 'class' => 'select select-product-option-type required-option-select', 'extra_params' => 'onchange="bOption.changeType(event)"'))->setName($this->getFieldName() . '[{{index}}][type]')->setOptions($this->_optionTypes->toOptionArray());
     return $select->getHtml();
 }