Exemple #1
0
 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());
 }
Exemple #2
0
 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']);
 }
Exemple #3
0
 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']);
 }
Exemple #4
0
 /**
  * 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;
 }