コード例 #1
0
 /**
  * @param NodeType $nodetype
  * @return boolean
  */
 private function isNodeTypeInAllowedSite(NodeType $nodetype)
 {
     // dont restrict abstract nodes
     if ($nodetype->isAbstract()) {
         return true;
     }
     $deniedWilcard = false;
     $allowedSites = $nodetype->getConfiguration('allowedSites');
     if ($allowedSites) {
         $currentDomain = $this->domainRepository->findOneByActiveRequest();
         if ($currentDomain !== null) {
             $currentSite = $currentDomain->getSite();
         } else {
             $currentSite = $this->siteRepository->findFirstOnline();
         }
         if (!$currentSite) {
             return true;
         }
         foreach ($allowedSites as $siteName => $allowed) {
             if ($allowed == TRUE && $siteName == '*' | $currentSite->getSiteResourcesPackageKey() == $siteName) {
                 return true;
             }
             if ($allowed == FALSE && $currentSite->getSiteResourcesPackageKey() == $siteName) {
                 return false;
             }
             if ($allowed == TRUE && $siteName == '*') {
                 $deniedWilcard = false;
             }
             if ($allowed == FALSE && $siteName == '*') {
                 $deniedWilcard = true;
             }
         }
         if ($deniedWilcard == true) {
             return false;
         }
     }
     return true;
 }
コード例 #2
0
 /**
  * @param string $nodeTypeName
  * @param NodeType $nodeType
  * @return void
  */
 protected function readNodeTypeConfiguration($nodeTypeName, NodeType $nodeType)
 {
     $nodeTypeConfiguration = $nodeType->getFullConfiguration();
     $this->superTypeConfiguration['typo3:' . $nodeTypeName] = array();
     /** @var NodeType $superType */
     foreach ($nodeType->getDeclaredSuperTypes() as $superType) {
         $this->superTypeConfiguration['typo3:' . $nodeTypeName][] = 'typo3:' . $superType->getName();
     }
     $nodeTypeProperties = array();
     if (isset($nodeTypeConfiguration['properties'])) {
         foreach ($nodeTypeConfiguration['properties'] as $property => $propertyConfiguration) {
             // TODO Make sure we can configure the range for all multi column elements to define what types a column may contain
             $this->addProperty('typo3:' . $nodeTypeName, 'typo3:' . $property, $propertyConfiguration);
             $nodeTypeProperties[] = 'typo3:' . $property;
         }
     }
     $metadata = array();
     $metaDataPropertyIndexes = array('ui');
     foreach ($metaDataPropertyIndexes as $propertyName) {
         if (isset($nodeTypeConfiguration[$propertyName])) {
             $metadata[$propertyName] = $nodeTypeConfiguration[$propertyName];
         }
     }
     if ($nodeType->isAbstract()) {
         $metadata['abstract'] = true;
     }
     $this->types['typo3:' . $nodeTypeName] = (object) array('label' => $nodeType->getLabel() ?: $nodeTypeName, 'id' => 'typo3:' . $nodeTypeName, 'properties' => array(), 'specific_properties' => $nodeTypeProperties, 'subtypes' => array(), 'metadata' => (object) $metadata, 'supertypes' => $this->superTypeConfiguration['typo3:' . $nodeTypeName], 'url' => 'http://www.typo3.org/ns/2012/Flow/Packages/Neos/Content/', 'ancestors' => array(), 'comment' => '', 'comment_plain' => '');
 }