本文整理汇总了PHP中TYPO3\Eel\FlowQuery\FlowQuery::context方法的典型用法代码示例。如果您正苦于以下问题:PHP FlowQuery::context方法的具体用法?PHP FlowQuery::context怎么用?PHP FlowQuery::context使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Eel\FlowQuery\FlowQuery
的用法示例。
在下文中一共展示了FlowQuery::context方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildItems
/**
* @return array
*/
public function buildItems()
{
$output = array();
$dimension = $this->getDimension();
foreach ($this->getPresetsInCorrectOrder() as $presetName => $presetConfiguration) {
$q = new FlowQuery(array($this->currentNode));
$nodeInOtherDimension = $q->context(array('dimensions' => array($dimension => $presetConfiguration['values']), 'targetDimensions' => array($dimension => reset($presetConfiguration['values']))))->get(0);
if ($nodeInOtherDimension !== NULL && $this->isNodeHidden($nodeInOtherDimension)) {
$nodeInOtherDimension = NULL;
}
$item = array('node' => $nodeInOtherDimension, 'state' => $this->calculateItemState($nodeInOtherDimension), 'label' => $presetConfiguration['label'], 'presetName' => $presetName, 'preset' => $presetConfiguration);
$output[] = $item;
}
return $output;
}
示例2: generateUriPathSegments
/**
* Generate missing URI path segments
*
* This generates URI path segment properties for all document nodes which don't have
* a path segment set yet.
*
* @param string $workspaceName
* @param boolean $dryRun
* @return void
*/
public function generateUriPathSegments($workspaceName, $dryRun)
{
$baseContext = $this->createContext($workspaceName, []);
$baseContextSiteNodes = $baseContext->getNode('/sites')->getChildNodes();
if ($baseContextSiteNodes === []) {
return;
}
foreach ($this->dimensionCombinator->getAllAllowedCombinations() as $dimensionCombination) {
$flowQuery = new FlowQuery($baseContextSiteNodes);
$siteNodes = $flowQuery->context(['dimensions' => $dimensionCombination, 'targetDimensions' => []])->get();
if (count($siteNodes) > 0) {
$this->output->outputLine('Searching for nodes with missing URI path segment in dimension "%s"', array(trim(NodePaths::generateContextPath('', '', $dimensionCombination), '@;')));
foreach ($siteNodes as $siteNode) {
$this->generateUriPathSegmentsForNode($siteNode, $dryRun);
}
}
}
}
示例3: getLastVisitedNode
/**
*
* @param string $workspaceName
* @return NodeInterface
*/
protected function getLastVisitedNode($workspaceName)
{
if (!$this->session->isStarted() || !$this->session->hasKey('lastVisitedNode')) {
return null;
}
try {
$lastVisitedNode = $this->propertyMapper->convert($this->session->getData('lastVisitedNode'), NodeInterface::class);
$q = new FlowQuery([$lastVisitedNode]);
$lastVisitedNodeUserWorkspace = $q->context(['workspaceName' => $workspaceName])->get(0);
return $lastVisitedNodeUserWorkspace;
} catch (\Exception $exception) {
return null;
}
}
示例4: getNodeInDimensions
/**
* Get the current node in the given dimensions.
* If it doesn't exist the method returns null.
*
* @param array $dimensions
* @param array $targetDimensions
* @return NodeInterface|null
*/
protected function getNodeInDimensions(array $dimensions, array $targetDimensions)
{
$q = new FlowQuery([$this->currentNode]);
return $q->context(['dimensions' => $dimensions, 'targetDimensions' => $targetDimensions])->get(0);
}
示例5: generateUriPathSegments
/**
* Generate missing URI path segments
*
* This generates URI path segment properties for all document nodes which don't have
* a path segment set yet.
*
* @param string $workspaceName
* @param boolean $dryRun
* @return void
*/
public function generateUriPathSegments($workspaceName, $dryRun)
{
$baseContext = $this->createContext($workspaceName, []);
$baseContextSitesNode = $baseContext->getNode(SiteService::SITES_ROOT_PATH);
if (!$baseContextSitesNode) {
$this->output->outputLine('<error>Could not find "' . SiteService::SITES_ROOT_PATH . '" root node</error>');
return;
}
$baseContextSiteNodes = $baseContextSitesNode->getChildNodes();
if ($baseContextSiteNodes === []) {
$this->output->outputLine('<error>Could not find any site nodes in "' . SiteService::SITES_ROOT_PATH . '" root node</error>');
return;
}
foreach ($this->dimensionCombinator->getAllAllowedCombinations() as $dimensionCombination) {
$flowQuery = new FlowQuery($baseContextSiteNodes);
$siteNodes = $flowQuery->context(['dimensions' => $dimensionCombination, 'targetDimensions' => []])->get();
if (count($siteNodes) > 0) {
$this->output->outputLine('Checking for nodes with missing URI path segment in dimension "%s"', array(trim(NodePaths::generateContextPath('', '', $dimensionCombination), '@;')));
foreach ($siteNodes as $siteNode) {
$this->generateUriPathSegmentsForNode($siteNode, $dryRun);
}
}
}
$this->persistenceManager->persistAll();
}