Project

General

Profile

Actions

Feature #62242

closed

Add \TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuItemGroupViewHelper

Added by Kay Strobach over 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
Start date:
2014-10-15
Due date:
% Done:

100%

Estimated time:
PHP Version:
5.5
Tags:
Complexity:
no-brainer
Sprint Focus:

Description

Using this ViewHelper we can use OptGroups in the Backend Selectfield which controls which function selected

<?php

namespace TYPO3\CMS\Fluid\ViewHelpers\Be\Menus;

class ActionMenuItemGroupViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\Menus\ActionMenuViewHelper {
    /**
     * @var string
     */
    protected $tagName = 'optgroup';

    /**
     * @param string $label
     * @return string
     */
    public function render($label = '') {
        $this->tag->addAttribute('label', $label);
        $options = '';
        foreach ($this->childNodes as $childNode) {
            if ($childNode instanceof \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode) {
                $options .= $childNode->evaluate($this->renderingContext);
            }
        }
        $this->tag->setContent($options);
        return $this->tag->render();
    }
}

Usage Example

<f:be.menus.actionMenu>
    <f:be.menus.actionMenuItem label="Default: Welcome" controller="Default" action="index" />
    <f:be.menus.actionMenuItem label="Community: get in touch" controller="Community" action="index" />

    <dev:be.menus.actionMenuItemGroup label="Information">
        <f:be.menus.actionMenuItem label="PHP Information" controller="Information" action="listPhpInfo" />
        <f:be.menus.actionMenuItem label="Documentation" controller="Information" action="documentation" />
        <f:be.menus.actionMenuItem label="Hooks" controller="Information" action="hooks" />
        <f:be.menus.actionMenuItem label="Signals" controller="Information" action="signals" />
        <f:be.menus.actionMenuItem label="XClasses" controller="Information" action="xclass" />
    </dev:be.menus.actionMenuItemGroup>
</f:be.menus.actionMenu>
Actions

Also available in: Atom PDF