PHP code example of heimrichhannot / contao-newsnavigation-bundle

1. Go to this page and download the library: Download heimrichhannot/contao-newsnavigation-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

heimrichhannot / contao-newsnavigation-bundle example snippets


 if ($this->previousArticle): 

use HeimrichHannot\NewsNavigationBundle\Event\NewsNavigationFilterEvent;

function __invoke(NewsNavigationFilterEvent $event): void
{        
    if ($event->model->someCustomTstamp) {
        $event->filter->setColumns(array_merge($event->filter->getColumns(), ['someCustomTstamp>=?']));
        $event->filter->setValues(array_merge($event->filter->getValues(), [$event->model->someCustomTstamp]));
    }
    
    if (!empty(StringUtil::deserialize($event->moduleModel->categories, true))) {
        $filter->setColumns(array_merge($filter->getColumns(), ['tl_news.categories IN (?)']));
        $filter->setValues(array_merge($filter->getValues(), StringUtil::deserialize($event->moduleModel->categories, true)));
    }
}