[ 'name' => 'Category', 'type' => 'list', 'values' => [ 'All' => 'all', 'Games' => 'games', 'Books' => 'books', 'Software' => 'software', ], 'defaultValue' => 'all', ], ], ]; public function collectData() { $html = getSimpleHTMLDOM(self::URI . 'bundles'); if (!$html) return; // Find the script tag with id "landingPage-json-data" $scriptTag = $html->find('script#landingPage-json-data', 0); if (!$scriptTag) return; $jsonData = $scriptTag->innertext; $data = json_decode($jsonData, true); if (!$data) return; $category = $this->getInput('category'); $bundles = []; // Get bundles based on category if ($category === 'all') { // Collect all bundles from all categories if (isset($data['data']['games']['mosaic'][0]['products'])) { $bundles = array_merge($bundles, $data['data']['games']['mosaic'][0]['products']); } if (isset($data['data']['books']['mosaic'][0]['products'])) { $bundles = array_merge($bundles, $data['data']['books']['mosaic'][0]['products']); } if (isset($data['data']['software']['mosaic'][0]['products'])) { $bundles = array_merge($bundles, $data['data']['software']['mosaic'][0]['products']); } // Sort by start date (newest first) usort($bundles, function($a, $b) { $timeA = isset($a['start_date|datetime']) ? strtotime($a['start_date|datetime']) : 0; $timeB = isset($b['start_date|datetime']) ? strtotime($b['start_date|datetime']) : 0; return $timeB - $timeA; }); } else { // Get bundles for specific category if (isset($data['data'][$category]['mosaic'][0]['products'])) { $bundles = $data['data'][$category]['mosaic'][0]['products']; } } foreach ($bundles as $bundle) { $item = []; $item['title'] = $bundle['tile_name'] ?? $bundle['tile_short_name'] ?? 'Unknown Bundle'; $item['uri'] = self::URI . ltrim($bundle['product_url'], '/'); $item['uid'] = $bundle['machine_name']; // Author if (isset($bundle['author'])) { $item['author'] = $bundle['author']; } // Timestamp if (isset($bundle['start_date|datetime'])) { $item['timestamp'] = strtotime($bundle['start_date|datetime']); } // Build content $content = ''; // Add image if (isset($bundle['tile_image'])) { $content .= '
' . $bundle['marketing_blurb'] . '
' . $bundle['detailed_marketing_blurb'] . '
'; } elseif (isset($bundle['marketing_blurb'])) { $content .= '' . $bundle['marketing_blurb'] . '
'; } // Add highlights if (isset($bundle['highlights']) && is_array($bundle['highlights'])) { $content .= 'Details: