1 <?php
 2 
 3 /**
 4  * REX_CLANG[id=x field=xzy].
 5  *
 6  * Arguments:
 7  *   - id
 8  *   - field
 9  *
10  * @author gharlan
11  *
12  * @package redaxo\core
13  */
14 class rex_var_clang extends rex_var
15 {
16     /**
17      * {@inheritdoc}
18      */
19     protected function getOutput()
20     {
21         $field = $this->getParsedArg('field', null, true);
22         if (null === $field) {
23             return false;
24         }
25 
26         $id = $this->getParsedArg('id');
27         $getMethod = $id ? 'get(' . $id . ')' : 'getCurrent()';
28 
29         return 'htmlspecialchars(rex_clang::' . $getMethod . '->getValue(' . $field . '))';
30     }
31 }
32