public function initTwig() { $config = DI::get('Config'); // Add custom namespace path to Imagine lib $vendorDir = $config->get('site.path') . '/../vendor'; $autoload = (require $vendorDir . '/autoload.php'); $autoload->add('Twig_', __DIR__ . '/vendor/twig/lib'); $this->twig = new Twig($config); $this->twig->init(); Di::set('Twig', $this->twig); Hook::trigger(Hook::ACTION, 'twigInitialized', $this->twig->getEnvironment()); }
public function install() { $this->addDateTag(); $this->addPageTag(); $this->addSiteTag(); $this->addIncludeTag(); $this->addTwigTag(); $this->addLinkTag(); $this->addEmailTag(); $this->addTelTag(); $this->addImageTag(); $this->addFileTag(); $this->addListingTag(); $this->addBlocksTag(); Hook::trigger(Hook::ACTION, 'addShortcode', $this->shortcode); Hook::attach('renderContent', [$this, 'renderContent']); }
public function install() { $this->addDateTag(); $this->addPageTag(); $this->addSiteTag(); $this->addIncludeTag(); $this->addTwigTag(); // http://getkirby.com/docs/content/text#basic-formats $this->addLinkTag(); $this->addEmailTag(); $this->addTelTag(); $this->addImageTag(); $this->addFileTag(); $this->addListingTag(); $this->addBlocksTag(); Hook::trigger(Hook::ACTION, 'addShortcode', $this->shortcode); Hook::attach('renderContent', [$this, 'renderContent']); }
/** * Renders a page content segment. * @param string|int $segmentId * @param Page $page * @return string */ public function renderPageSegment($segmentId, Page $page) { if (is_null($page)) { $page = Application::getPage(); } $segment = $page->getSegment($segmentId); $segment->string = Hook::trigger(Hook::FILTER, 'renderContent', $segment->string, $page->getData()); return $segment->string; }