<?php

$loader = $this->registry->get('load');
$loader->controller('product/productList');

class ControllerModuleBrandProducts extends ControllerProductProductList
{
    public function index($setting = null)
    {
        $this->language->load('module/brandproducts');

        if (isset($setting['hide_title'])) {
            $heading_title = false;
        } else {
            $heading_title = ($this->config->get('brandproducts_title')) ? $this->config->get('brandproducts_title') : $this->language->get('heading_title');
        }

        $this->data['productListTitle'] = array();

        $this->data['product_id'] = $this->request->get['product_id'];
        $this->data['heading_title'] = $heading_title;
        $this->data['product_list_title_style'] = $this->config->get('product_list_title_style');
        $this->data['Type_ProductListTitleStyle'] = $this->load->typeForTwig('Type_ProductListTitleStyle');

        $this->data['productListTitle'] = array(
            'heading_title' => $heading_title,
            'heading_subtitle' => $this->config->get('brandproducts_subtitle') ? $this->config->get('brandproducts_subtitle') : '',
            'link' => (isset($this->data['link'])) ? $this->data['link'] : '',
        );

        $this->productlistitle->setProductListTitle($this->data['productListTitle']);

        $this->childrenData = array(
            'product/productList/moduleBrandproducts' => $setting
        );

        $this->children = array(
            'common/product_list_title',
        );

        $this->render('module/brandproducts');
    }
}