[ 'name' => 'Bundle type', 'type' => 'list', 'defaultValue' => 'all', 'values' => [ 'All' => 'all', 'Books' => 'book-', 'ELearning' => 'elearning-', 'Games' => '', 'Software' => 'software-', ] ] ]]; const IMGURL = 'https://fanatical.imgix.net/product/original/'; public function collectData() { $api = 'https://www.fanatical.com/api/all/en'; $json = json_decode(getContents($api), true)['pickandmix']; $type = $this->getInput('type'); foreach ($json as $element) { if ($type != 'all') { if ($element['type'] != $type . 'bundle') { continue; } } $item = [ 'categories' => [$element['type']], 'content' => ''; $this->items[] = $item; } } public function getName() { $name = parent::getName(); $name .= $this->getKey('type') ? ' - ' . $this->getKey('type') : ''; return $name; } public function getURI() { $uri = parent::getURI(); $type = $this->getKey('type'); if ($type) { $uri .= 'bundle/'; if ($type != 'All') { $uri .= strtolower($type); } } return $uri; } public function getIcon() { return 'https://cdn.fanatical.com/production/icons/fanatical-icon-android-chrome-192x192.png'; } }