Project

General

Profile

Actions

Bug #72543

closed

DirectoryViewHelper levelAs not working in fluid_styled_content

Added by Kevin Ditscheid almost 9 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Fluid Styled Content
Target version:
-
Start date:
2016-01-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

I added a menu via <ce:menu.directory pageUids="{pageUids}" as="pages" levelAs="level"> and the generation of the menu works fine, but the variable "level" is empty and it seems that the view helper does not send the right register variable to the template.
The view Helper does this:

if (!empty($levelAs)) {
$variables[$levelAs] = $typoScriptFrontendController->register['ceMenuLevel'];
}

but the register that is used to count the level is in:

$typoScriptFrontendController->register['ceMenuLevel_directory']

So the DirectoryViewHelper render-function needs to look something like this:

@
public function render() {
$typoScriptFrontendController = $this->getTypoScriptFrontendController();
$as = $this->arguments['as'];
$pageUids = (array)$this->arguments['pageUids'];
$entryLevel = $this->arguments['entryLevel'];
$levelAs = $this->arguments['levelAs'];
$maximumLevel = $this->arguments['maximumLevel'];
$includeNotInMenu = (bool)$this->arguments['includeNotInMenu'];
$includeMenuSeparator = (bool)$this->arguments['includeMenuSeparator'];

$pageUids = $this->getPageUids($pageUids, $entryLevel);
$pages = $typoScriptFrontendController->sys_page->getMenu(
$pageUids,
'*',
'sorting',
$this->getPageConstraints($includeNotInMenu, $includeMenuSeparator)
);
$output = '';
if (!empty($pages)) {
if (!$typoScriptFrontendController->register['ceMenuLevel_directory']) {
$typoScriptFrontendController->register['ceMenuLevel_directory'] = 1;
$typoScriptFrontendController->register['ceMenuMaximumLevel_directory'] = $maximumLevel;
} else {
$typoScriptFrontendController->register['ceMenuLevel_directory']++;
}
if ($typoScriptFrontendController->register['ceMenuLevel_directory'] > $typoScriptFrontendController->register['ceMenuMaximumLevel_directory']) {
// count down before returning or the counter register will be messed up
$typoScriptFrontendController->register['ceMenuLevel_directory']--;
return '';
}
$variables = array(
$as => $pages
);
if (!empty($levelAs)) {
// register right variable for template usage
$variables[$levelAs] = $typoScriptFrontendController->register['ceMenuLevel_directory'];
}
$output = $this->renderChildrenWithVariables($variables);
$typoScriptFrontendController->register['ceMenuLevel_directory']--;
if ($typoScriptFrontendController->register['ceMenuLevel_directory'] <= 0) {
unset($typoScriptFrontendController->register['ceMenuLevel_directory']);
unset($typoScriptFrontendController->register['ceMenuMaximumLevel_directory']);
}
}
return $output;
}
@

TYPO3 version is 7.6.2

Actions #1

Updated by Gerrit Code Review almost 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/45957

Actions #2

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/45957

Actions #3

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46007

Actions #4

Updated by Georg Ringer almost 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF