/** * Handle the options. * * @param AddonFieldType $fieldType */ public function handle(AddonFieldType $fieldType, AddonCollection $addons) { // Restrict to type if desired. if ($type = array_get($fieldType->getConfig(), 'type')) { $addons = $addons->{snake_case(str_plural($type))}(); } // Search extensions if desired. if ($addons instanceof ExtensionCollection && ($search = array_get($fieldType->getConfig(), 'search'))) { $addons = $addons->search($search); } // Enabled only if extension or module. if ($addons instanceof ExtensionCollection || $addons instanceof ModuleCollection) { $addons = $addons->enabled(); } // Limit to theme type if desired. if ($addons instanceof ThemeCollection && ($type = array_get($fieldType->getConfig(), 'theme_type'))) { $addons = $addons->{$type}(); } $fieldType->setOptions($addons->lists('name', 'namespace')->all()); }
/** * Handle the command. * * @param Container $container */ public function handle(Container $container) { $container->call(array_get($this->fieldType->getConfig(), 'handler'), ['fieldType' => $this->fieldType]); }