[TASK] Improve variable access in compiled templates
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / Core / ViewHelper / TemplateVariableContainer.php
index e532859..76a0464 100644 (file)
@@ -183,4 +183,18 @@ class TemplateVariableContainer implements \ArrayAccess {
                return $this->get($identifier);
        }
 
+       /**
+        * Gets a variable or NULL if it does not exist
+        *
+        * @param string $variableName name of the variable
+        * @return mixed the stored variable or NULL
+        * @internal
+        */
+       public function getOrNull($variableName) {
+               if ($variableName === '_all') {
+                       return $this->variables;
+               }
+
+               return isset($this->variables[$variableName]) ? $this->variables[$variableName] : NULL;
+       }
 }