title = "test"
url = "/test"
layout = "default_new"
is_hidden = 0

[newsPosts]
pageNumber = "{{ :page }}"
postsPerPage = 10
noPostsMessage = "Отсутсвие постов"
sortOrder = "published_at desc"
postFeatured = 0
postPage = "news/post"
==
<?php
use RainLab\Translate\Classes\Translator;
protected $translator;

function onStart()
{
    
    $this['currentLanguage'] = $this->activeLocale;

    // featured news 

    $this->translator = Translator::instance();
    $this['SelectedLanguage'] = $this->activeLocale = $this->translator->getLocale();

    $featured = \Indikator\News\Models\Posts::where("featured", true)->where("locale", App::getLocale())->where("status", 1)->orderBy('published_at', 'desc')->get()->first();
    
    $this['postFeatured'] = $featured; 
    if($featured->image){
        //$this['imageType'] = $featured->getImageDetails($featured->images->last->path->disk_name);
        
        $this['imageType'] = $featured->image[0]["type"];
    }

    // end featured news


    // last news
    
    $this['lastNews'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())->where("status", 1)->where("category_id", "!=", $this->theme->colleagues_news)->whereNotIn('category_id', [20,21,22])->orderBy('published_at', 'desc')->limit(10)->get();
    
    // end last news


    // collegue News 

    $this['collegueNews'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())->where("status", 1)->where("category_id", $this->theme->colleagues_news)->orderBy('published_at', 'desc')->limit(9)->get();
    
    $this["collegueNews_cat"] = \Indikator\News\Models\Categories::where("id", $this->theme->colleagues_news)->first();
    // end collegue News 

    // intro news 3rd column

    $this['intro_cat_news'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())->where("status", 1)->where("category_id", $this->theme->intro_cat_news)->orderBy('published_at', 'desc')->limit(10)->get();
    
    $this["intro_cat"] = \Indikator\News\Models\Categories::where("id", $this->theme->intro_cat_news)->first();

    // end intro new
    
}
?>
==
{% set CurrentLanguage = SelectedLanguage %}

{% partial 'home_new_intro' %}
{% partial 'home_new_banner_news' %}
{% partial 'home_new_last_news' %}
{% partial 'home_n_new_media' %}