Completed
Pull Request — master (#132)
by
unknown
08:03 queued 03:53
created

ButtonGroupRenderer::render()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 2
eloc 10
nc 2
nop 0
1
<?php
2
namespace Fab\Vidi\Grid;
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
use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19
/**
20
 * Class for rendering the "Button Group" in the Grid, e.g. edit, delete, etc..
21
 */
22
class ButtonGroupRenderer extends ColumnRendererAbstract
23
{
24
25
    /**
26
     * Configure the "Button Group" Grid Renderer.
27
     */
28
    public function __construct()
29
    {
30
        $configuration = array(
31
            'sortable' => FALSE,
32
            'canBeHidden' => FALSE,
33
            'width' => '100px',
34
        );
35
        parent::__construct($configuration);
36
    }
37
38
    /**
39
     * Render the "Button Group" in the Grid, e.g. edit, delete, etc..
40
     *
41
     * @return string
42
     */
43
    public function render()
44
    {
45
        $components = $this->getModuleLoader()->getGridButtonsComponents();
46
47
        $buttons = []
48
        foreach ($components as $component) {
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_FOREACH
Loading history...
49
50
            /** @var  $view */
51
            $view = GeneralUtility::makeInstance($component);
52
            $buttons[] = $view->render($this->getObject());
53
        }
54
55
        $output = sprintf(
56
            '<div class="btn-toolbar pull-right" role="toolbar" aria-label=""><div class="btn-group" role="group" aria-label="">%s</div></div>',
57
            implode("\n", $buttons)
58
        );
59
60
        return $output;
61
    }
62
63
}
64