1: <?php
2:
3: namespace Mapbender\CoreBundle\Extension;
4:
5: /**
6: * ElementExtension
7: */
8: class ElementExtension extends \Twig_Extension
9: {
10:
11: /**
12: * @inheritdoc
13: */
14: public function getName()
15: {
16: return 'mapbender_element';
17: }
18:
19: /**
20: * @inheritdoc
21: */
22: public function getFunctions()
23: {
24: return array(
25: 'element_class_title' => new \Twig_Function_Method($this, 'element_class_title'));
26: }
27:
28: /**
29: *
30: * @param type $element
31: * @return type
32: */
33: public function element_class_title($element)
34: {
35: $class = $element->getClass();
36: if(class_exists($class)) {
37: return $class::getClassTitle();
38: }
39: }
40: }
41:
42: