43696a85eeb7feda9b449a3eb7aa25f411c6d59c
[Packages/TYPO3.CMS.git] / typo3 / sysext / beuser / Classes / ViewHelpers / SectionViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Beuser\ViewHelpers;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Displays a section in backend module template, similar to \TYPO3\CMS\Backend\Template\DocumentTemplate::section()
19 *
20 * @author Felix Kopp <felix-source@phorax.com>
21 * @internal
22 */
23 class SectionViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
24
25 /**
26 * Display section with title and content
27 *
28 * @param string $title
29 * @param bool $collapsible
30 *
31 * @return string
32 * @see \TYPO3\CMS\Backend\Template\DocumentTemplate::section()
33 */
34 public function render($title, $collapsible = FALSE) {
35 if ($collapsible) {
36 $uniqueId = 'section_' . md5((microtime() . rand()));
37 return '<h3 class="collapsibleSection"><a href="#" onClick="$(\'' . $uniqueId . '\').toggle(); return false;">' . $title . '</a></h3>' . '<div id="' . $uniqueId . '" class="collapsibleSection">' . $this->renderChildren() . '</div>';
38 }
39 return '<h2>' . $title . '</h2>' . $this->renderChildren();
40 }
41
42 }