data['brand']); } /** * Return an array describing what kind of data the creator needs in * addition to the one it already has */ public function formSpecs(): ?array { $specs = []; if (empty($this->data['brand'])) { $specs['brand'] = fn () => select('Product brand', $this->listBrands()); } return $specs; } private function listBrands() { $bundles = Bundle::findBundles($this->disk, static::$section); $brands = []; foreach ($bundles as $bundle) { $brands[basename($bundle->getPath())] = $bundle->metadata()->get('title'); } asort($brands, SORT_NATURAL); return $brands; } /** * Return a boolean value indicating if this creator in particular can * create bundles for specified section */ public static function handles(string $section, ?array $data = []): bool { return $section === static::$section; } }