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

Returns the workspace this node is contained in
public getWorkspace ( ) : Workspace
Результат Workspace
 /**
  * @test
  */
 public function setWorkspacesAllowsForSettingTheWorkspaceForInternalPurposes()
 {
     /** @var Workspace|\PHPUnit_Framework_MockObject_MockObject $newWorkspace */
     $newWorkspace = $this->getMockBuilder(Workspace::class)->disableOriginalConstructor()->getMock();
     $this->assertSame($this->mockWorkspace, $this->nodeData->getWorkspace());
     $this->nodeData->setWorkspace($newWorkspace);
     $this->assertSame($newWorkspace, $this->nodeData->getWorkspace());
 }
Пример #2
0
 /**
  * The NodeData matches the context if the workspace matches exactly.
  * Needs to be adjusted for further context dimensions.
  *
  * @return boolean
  */
 protected function isNodeDataMatchingContext()
 {
     if ($this->nodeDataIsMatchingContext === null) {
         $workspacesMatch = $this->nodeData->getWorkspace() !== null && $this->context->getWorkspace() !== null && $this->nodeData->getWorkspace()->getName() === $this->context->getWorkspace()->getName();
         $this->nodeDataIsMatchingContext = $workspacesMatch && $this->dimensionsAreMatchingTargetDimensionValues();
     }
     return $this->nodeDataIsMatchingContext;
 }
 /**
  * Change the property on the given node.
  *
  * @param NodeData $node
  * @return NodeData
  */
 public function execute(NodeData $node)
 {
     $reference = (string) $node->getProperty('plugin');
     $workspace = $node->getWorkspace();
     do {
         if ($this->reverse === false && preg_match(NodeInterface::MATCH_PATTERN_PATH, $reference)) {
             $pluginNode = $this->nodeDataRepository->findOneByPath($reference, $node->getWorkspace());
         } else {
             $pluginNode = $this->nodeDataRepository->findOneByIdentifier($reference, $node->getWorkspace());
         }
         if (isset($pluginNode)) {
             break;
         }
         $workspace = $workspace->getBaseWorkspace();
     } while ($workspace && $workspace->getName() !== 'live');
     if (isset($pluginNode)) {
         $node->setProperty('plugin', $this->reverse === false ? $pluginNode->getIdentifier() : $pluginNode->getPath());
     }
     return $node;
 }
 /**
  * Generates a Context that exactly fits the given NodeData Workspace, Dimensions & Site.
  *
  * @param NodeData $nodeData
  * @return ContentContext
  */
 protected function createContextMatchingNodeData(NodeData $nodeData)
 {
     $nodePath = NodePaths::getRelativePathBetween(SiteService::SITES_ROOT_PATH, $nodeData->getPath());
     list($siteNodeName) = explode('/', $nodePath);
     $site = $this->siteRepository->findOneByNodeName($siteNodeName);
     $contextProperties = ['workspaceName' => $nodeData->getWorkspace()->getName(), 'invisibleContentShown' => true, 'inaccessibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $nodeData->getDimensionValues(), 'currentSite' => $site];
     if ($domain = $site->getFirstActiveDomain()) {
         $contextProperties['currentDomain'] = $domain;
     }
     return $this->_contextFactory->create($contextProperties);
 }
 /**
  * Generates a Context that exactly fits the given NodeData Workspace and Dimensions.
  *
  * TODO: We could get more specific about removed and invisible content by adding some more logic here that generates fitting values.
  *
  * @param NodeData $nodeData
  * @return Context
  */
 public function createContextMatchingNodeData(NodeData $nodeData)
 {
     return $this->contextFactory->create(array('workspaceName' => $nodeData->getWorkspace()->getName(), 'invisibleContentShown' => true, 'inaccessibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $nodeData->getDimensionValues()));
 }
 /**
  * Returns TRUE if the given node is in the workspace this filter expects.
  *
  * @param NodeData $node
  * @return boolean
  */
 public function matches(NodeData $node)
 {
     return $node->getWorkspace() !== null && $node->getWorkspace()->getName() === $this->workspaceName;
 }