<?php

namespace ProudNerds\Core;

/**
 * Class: Theme
 *
 * Functionality relating to the theme can be added and altered here.
 */
class Theme {
    /**
     * Theme options and settings constructor.
     */
    public function __construct() {
        $this->themeSupport();
        // $this->registerMenus();
        // $this->imageSizes();
        // $this->optionPages();
    }

    /**
     * Adds the functionality that the theme supports.
     */
    private function themeSupport() {
        add_theme_support('post-thumbnails');
        add_theme_support('html5');
        add_theme_support('title-tag');
        add_theme_support('navigation-menus');
    }

    /**
     * Register navigation menu locations for the theme.
     */
    private function registerMenus() {
        register_nav_menus(array(
            'main-menu'         => 'Hoofdmenu',
            'footer-menu-1'     => 'Footer menu 1',
            'footer-menu-2'     => 'Footer menu 2'
        ));
    }

    /**
     * Define image sizes used by WordPress when inserting media.
     */
    private function imageSizes() {
        add_image_size('example', 500, 500, true);
    }

    /**
     * Add theme option pages.
     */
    private function optionPages() {
        acf_add_options_page(array(
            'menu_title'	=> __('Thema', THEME_LANGUAGE_DOMAIN),
            'menu_slug' 	=> 'theme-options',
            'capability'	=> 'edit_posts',
            'redirect'		=> true
        ));

        acf_add_options_sub_page(array(
            'page_title' 	=> __('Algemene instellingen', THEME_LANGUAGE_DOMAIN),
            'menu_title'	=> __('Algemeen', THEME_LANGUAGE_DOMAIN),
            'parent_slug'	=> 'theme-options',
        ));

        acf_add_options_sub_page(array(
            'page_title' 	=> __('Header instellingen', THEME_LANGUAGE_DOMAIN),
            'menu_title'	=> __('Header', THEME_LANGUAGE_DOMAIN),
            'parent_slug'	=> 'theme-options',
        ));

        acf_add_options_sub_page(array(
            'page_title' 	=> __('Footer instellingen', THEME_LANGUAGE_DOMAIN),
            'menu_title'	=> __('Footer', THEME_LANGUAGE_DOMAIN),
            'parent_slug'	=> 'theme-options',
        ));
    }
}