Neos\Flow\Package\PackageManagerInterface::isPackageActive PHP Метод

isPackageActive() публичный Метод

Returns TRUE if a package is activated or FALSE if it's not.
public isPackageActive ( string $packageKey ) : boolean
$packageKey string The key of the package to check
Результат boolean TRUE if package is active, otherwise FALSE
    public function isPackageActive($packageKey);

Usage Example

 /**
  * Fetches the site with the given name and exports it into XML in the given package.
  *
  * @param array<Site> $sites
  * @param boolean $tidy Whether to export formatted XML
  * @param string $packageKey Package key where the export output should be saved to
  * @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "Neos.Neos:Page", "!Neos.Neos:Page,Neos.Neos:Text")
  * @return void
  * @throws NeosException
  */
 public function exportToPackage(array $sites, $tidy = false, $packageKey, $nodeTypeFilter = null)
 {
     if (!$this->packageManager->isPackageActive($packageKey)) {
         throw new NeosException(sprintf('Error: Package "%s" is not active.', $packageKey), 1404375719);
     }
     $contentPathAndFilename = sprintf('resource://%s/Private/Content/Sites.xml', $packageKey);
     $this->resourcesPath = Files::concatenatePaths(array(dirname($contentPathAndFilename), 'Resources'));
     Files::createDirectoryRecursively($this->resourcesPath);
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openUri($contentPathAndFilename);
     $this->xmlWriter->setIndent($tidy);
     $this->exportSites($sites, $nodeTypeFilter);
     $this->xmlWriter->flush();
 }
All Usage Examples Of Neos\Flow\Package\PackageManagerInterface::isPackageActive