/** * Prompts a selection of optional packages. * * @return mixed */ protected function promptOptionalPackages(array $packages) { if (!PackageInstallationFormManager::findForm($this->queue, 'optionalPackages')) { $container = new MultipleSelectionFormElementContainer(); $container->setName('optionalPackages'); foreach ($packages as $package) { $optionalPackage = new MultipleSelectionFormElement($container); $optionalPackage->setName('optionalPackages'); $optionalPackage->setLabel($package['packageName']); $optionalPackage->setValue($package['package']); $container->appendChild($optionalPackage); } $document = new FormDocument('optionalPackages'); $document->appendContainer($container); PackageInstallationFormManager::registerForm($this->queue, $document); return $document; } else { $document = PackageInstallationFormManager::getForm($this->queue, 'optionalPackages'); $document->handleRequest(); return $document->getValue('optionalPackages'); } }
/** * Prompts a selection of optional packages. * * @return mixed */ protected function promptOptionalPackages(array $packages) { if (!PackageInstallationFormManager::findForm($this->queue, 'optionalPackages')) { $container = new MultipleSelectionFormElementContainer(); $container->setName('optionalPackages'); $container->setLabel(WCF::getLanguage()->get('wcf.acp.package.optionalPackages')); $container->setDescription(WCF::getLanguage()->get('wcf.acp.package.optionalPackages.description')); foreach ($packages as $package) { $optionalPackage = new MultipleSelectionFormElement($container); $optionalPackage->setName('optionalPackages'); $optionalPackage->setLabel($package['packageName']); $optionalPackage->setValue($package['package']); $optionalPackage->setDescription($package['packageDescription']); if (!$package['isInstallable']) { $optionalPackage->setDisabledMessage(WCF::getLanguage()->get('wcf.acp.package.install.optionalPackage.missingRequirements')); } $container->appendChild($optionalPackage); } $document = new FormDocument('optionalPackages'); $document->appendContainer($container); PackageInstallationFormManager::registerForm($this->queue, $document); return $document; } else { $document = PackageInstallationFormManager::getForm($this->queue, 'optionalPackages'); $document->handleRequest(); return $document->getValue('optionalPackages'); } }