/**
  * Return options.
  *
  * @return mixed
  */
 public function toOptionArray()
 {
     $options = $this->productType->getAllOptions();
     //Add default option to first key of array. First key has empty value and empty label.
     $options[0]['value'] = '0';
     $options[0]['label'] = '---- Default Option ----';
     return $options;
 }
示例#2
0
 public function testGetAllOptions()
 {
     $res[] = ['value' => '', 'label' => ''];
     foreach ($this->getOptionArray() as $index => $value) {
         $res[] = ['value' => $index, 'label' => $value];
     }
     $this->assertEquals($res, $this->_model->getAllOptions());
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function getAllOptions()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getAllOptions');
     if (!$pluginInfo) {
         return parent::getAllOptions();
     } else {
         return $this->___callPlugins('getAllOptions', func_get_args(), $pluginInfo);
     }
 }
示例#4
0
 public function testGetAllOptions()
 {
     $options = $this->_productType->getAllOptions();
     $types = $this->_assertOptions($options);
     $this->assertContains('', $types);
 }