public function getContent() { return $this->output; }
/** * Parse a widget straight from the template, rather than adding it through pages. * * @internal if your widget outputs random data you should cache it inside the widget * Fork checks the output and if the output of the widget is random it will loop until the random data * is the same as in the previous iteration * @param string $var The variable. * @param string $module The module whose module we want to execute. * @param string $action The action to execute. * @param string $id The widget id (saved in data-column). * @return string|null */ public static function parseWidget($var, $module, $action, $id = null) { $data = $id !== null ? serialize(array('id' => $id)) : null; // create new widget instance and return parsed content $extra = new FrontendBlockWidget(Model::get('kernel'), $module, $action, $data); // set parseWidget because we will need it to skip setting headers in the display Model::getContainer()->set('parseWidget', true); try { $extra->execute(); $content = $extra->getContent(); Model::getContainer()->set('parseWidget', null); return $content; } catch (Exception $e) { // if we are debugging, we want to see the exception if (Model::getContainer()->getParameter('kernel.debug')) { throw $e; } return null; } }