request = $request; $this->storeRepository = $storeRepository; $this->config = $config; } /** * Get data * * @return array */ public function getData() { if (!$this->getCollection()->isLoaded()) { $this->getCollection()->addAttributeToFilter( 'type_id', $this->config->getComposableTypes() ); if ($storeId = $this->request->getParam('current_store_id')) { /** @var StoreInterface $store */ $store = $this->storeRepository->getById($storeId); $this->getCollection()->setStore($store); } $this->getCollection()->load(); } $items = $this->getCollection()->toArray(); return [ 'totalRecords' => $this->getCollection()->getSize(), 'items' => array_values($items), ]; } }