/** * Renders the given item. * * @param array $item * @param array $variables * @return string * @throws \RuntimeException If placeholder cannot be rendered. */ protected function renderItemContent(array $item, array $variables) { if (isset($item['data']) || array_key_exists('data', $item)) { $variables['data'] = $item['data']; } if (isset($item['template'])) { return $this->environment->render($item['template'], $variables); } if (isset($item['action'])) { $query = array(); if ($this->request) { $query = $this->request->query->all(); } return $this->kernelExtension->renderFragment($this->kernelExtension->controller($item['action'], $variables, $query)); } throw new \RuntimeException(sprintf('Cannot render placeholder item with keys "%s". Expects "template" or "action" key.', implode('", "', $item))); }