attributeRepository = $attributeRepository; } /** * @return array */ public function toOptionArray() { if (!isset($this->options)) { $this->options = []; try { $attribute = $this->attributeRepository->get(Product::ENTITY, 'custom_stock_status'); $this->options = $attribute->getSource()->getAllOptions(false); } catch (NoSuchEntityException $exception) { $this->options = []; } array_unshift($this->options, [ 'label' => __('NONE'), 'value' => '' ]); } return $this->options; } }