1 | <?php |
||
37 | class Geolocation extends FormText |
||
38 | { |
||
39 | protected $script = 'org-heigl-geolocation/form-element/geolocation'; |
||
40 | |||
41 | public function render(ElementInterface $element) |
||
42 | { |
||
43 | $renderer = $this->getView(); |
||
44 | |||
45 | $basePath = $renderer->basePath(); |
||
46 | |||
47 | if ($renderer instanceof PhpRenderer) { |
||
48 | |||
49 | $renderer->headScript()->appendFile($basePath . '/jquery/jquery.min.js'); |
||
50 | $renderer->headScript()->appendFile($basePath . '/orgheiglgeolocation/lib/leaflet/leaflet.js'); |
||
51 | $renderer->headScript()->appendFile($basePath . '/orgheiglgeolocation/js/orgHeiglGeolocation.js'); |
||
52 | $renderer->headScript()->appendScript('$(\'.orgheiglgeolocation\').orgHeiglGeolocation()'); |
||
53 | $renderer->headLink()->appendStylesheet($basePath . '/orgheiglgeolocation/lib/leaflet/leaflet.css'); |
||
54 | } |
||
55 | |||
56 | $class = $element->getAttribute('class'); |
||
57 | $class .= " orgheiglgeolocation"; |
||
58 | |||
59 | $element->setAttribute('class', $class); |
||
60 | |||
61 | |||
62 | return $this->getView()->render($this->script, array( |
||
63 | 'element' => $element, |
||
64 | 'renderedElement' => parent::render($element), |
||
65 | )); |
||
66 | } |
||
67 | |||
68 | public function __invoke(ElementInterface $element = null) |
||
72 | } |
||
73 | |||
74 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):