<?php
class ModuleFmSearchForm extends CDController{

  public function __construct() {

    $this->view = 'fm/partials/forms/form-search.twig';

  }

  public function get_context(){

    $args = array(
      'taxonomy' => 'fm_magazine_cat',
    );

    $this->data['module']['fm_categories'] = Timber::get_terms($args);

    $pages = get_posts(
      array(
        'post_type' => 'page',
        'fields' => 'ids',
        'meta_key' => '_wp_page_template',
        'meta_value' => 'fm-search'
      )
    );

    $this->data['module']['action'] = get_the_permalink($pages[0]);
  }

}
