dataHelper = $dataHelper; } /** * Get data * * @return array */ public function getData() { if (!$this->getCollection()->isLoaded()) { $this->getCollection()->addAttributeToFilter( 'type_id', $this->dataHelper->getAllowedSelectionTypes() ); $this->getCollection()->addFilterByRequiredOptions(); $this->getCollection()->addStoreFilter( \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $this->getCollection()->load(); } $items = $this->getCollection()->toArray(); return [ 'totalRecords' => $this->getCollection()->getSize(), 'items' => array_values($items), ]; } }