public function decorate(RendererAwareInterface $owner, &$content, $data) { $template = empty($data['template']) ? $this->template : $data['template']; $view = new MiniView($this, sprintf('%s/%s', $owner->getRootPath(), $owner->getLayoutPath())); $view->setViewsPath(''); $data['content'] = $content; $content = $view->render($template, ['data' => (object) $data, 'view' => $view], true); }
public function getData(RendererAwareInterface $owner, $filename, $view) { $data = []; $path = sprintf('%s/%s/%s', $owner->getRootPath(), $owner->getContentPath(), $this->filename); if (file_exists($path)) { $data = (array) json_decode(file_get_contents($path)); } return $data; }
public function getData(RendererAwareInterface $owner, $filename, $view) { $data = []; $rootPath = realpath($owner->getRootPath()); $path = dirname($filename); $parts = explode('/', $path); foreach ($parts as $part) { $filePath = sprintf('%s/%s', $path, $this->filename); if (file_exists($filePath)) { $data = array_merge((array) json_decode(file_get_contents($filePath), false), $data); } $path = realpath($path . '/../'); if ($path === $rootPath) { break; } } return $data; }
public function decorate(RendererAwareInterface $owner, &$content, $data) { foreach ($owner->getPostProcessors() as $postProcessor) { $postProcessor->decorate($owner, $content, $data); } }