public function getViewContext(array $row, RequestInterface $request = NULL) { if (FALSE === $this->viewContext instanceof ViewContext) { // Note: we do *not* store a local property because we do *not* want this function // to re-use the ViewContext unless explicitly set from the outside or initialised // by a sub-class. $context = new ViewContext($this->getTemplatePathAndFilename($row), $this->getControllerPackageNameFromRecord($row), $this->getControllerNameFromRecord($row), $request); $context->setSectionName($this->getConfigurationSectionName($row)); $context->setTemplatePaths(new TemplatePaths($this->getTemplatePaths($row))); $context->setVariables($this->getViewVariables($row)); return $context; } return $this->viewContext; }