<?php
class ModuleFmAdvertising extends CDController{

  protected $args = array();

  public function __construct($args = null) {

    if( isset($args) && $args != null ){
			$this->args = $args;
		}else{
      $this->args = null;
    }

    if($args && $args['direction'] == 'vertical'){
      $this->view = 'fm/partials/sections/advertising-vertical.twig';
    }else{
      $this->view = 'fm/partials/sections/advertising-horizontal.twig';
    }


  }

  public function get_context(){

    $data = get_field('option_module_fm_advertising', 'option');

    if( isset($this->args['location']) && $this->args['location'] == 'home' ){
      $data['brands'] = $data['brands_home'];
      unset($data['brands_home']);
    }

    $this->data['module'] = $data;

  }

}
