<?php
class ModuleFmOtherNumbers extends CDController{

  protected $args = array();

  public function __construct($args = null) {

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

    $this->view = 'fm/partials/sections/other-numbers.twig';

  }

  public function get_context(){

    $this->data['module'] = get_field('option_module_fm_other_numbers', 'option');

    $magazine_id = $this->args['magazine_id'];

    $args = array(
      'post_type' => 'fm_magazine',
      'posts_per_page' => 8,
      'post_parent' => 0
    );

    if($magazine_id){
      $args['post__not_in'] = array($magazine_id);
    }

    $this->data['module']['other_magazines'] = CDTimber::get_posts($args);

  }

}
