Completed
Pull Request — master (#470)
by Claus
01:35
created

ExampleViewHelper::initializeArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
namespace TYPO3Fluid\Fluid\ViewHelpers;
4
5
/*
6
 * This file belongs to the package "TYPO3 Fluid".
7
 * See LICENSE.txt that was shipped with this package.
8
 */
9
10
use TYPO3Fluid\Fluid\Component\EmbeddedComponentInterface;
11
use TYPO3Fluid\Fluid\Component\SequencingComponentInterface;
12
use TYPO3Fluid\Fluid\Core\Parser\Sequencer;
13
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
14
15
/**
16
 * Template Example ViewHelper
17
 *
18
 * Allows you to embed a block of usage examples into
19
 * a template; the tag contents are NOT parsed as Fluid
20
 * code and will be possible to extract in documentation
21
 * or design systems.
22
 *
23
 * Ignores nested Fluid code except for the closing tag
24
 * that ends the block.
25
 */
26
class ExampleViewHelper extends AbstractViewHelper implements EmbeddedComponentInterface, SequencingComponentInterface
27
{
28
    protected $escapeOutput = false;
29
30
    protected function initializeArguments()
31
    {
32
        $this->registerArgument('title', 'string', 'Optional string title of the code example piece');
33
    }
34
35
    public function sequence(Sequencer $sequencer, ?string $namespace, string $method): void
36
    {
37
        $sequencer->sequenceUntilClosingTagAndIgnoreNested($this, $namespace, $method);
38
    }
39
}
40