<?php

/**
 * @author : Webforia Studio
 */

namespace Retheme\Customizer;

use Retheme\Customizer_Base;

class Footer extends Customizer_Base {

    public function __construct() {
        $this->set_section();
        $this->add_footer();
    }

    public function set_section() {

        $this->add_section('footer', [
            'title' => __('Footer', 'jelajah-text'),
        ]);
    }

    public function add_footer() {
        $section = 'footer';

        $this->add_header([
            'label' => __('Footer Options', 'jelajah-text'),
            'section' => $section,
        ]);

        $this->add_field([
            'type' => 'radio-image',
            'section' => $section,
            'settings' => 'footer_widget_layout',
            'label' => __('Layout', 'jelajah-text'),
            'description' => sprintf(__('Visit the <a href="%s">Widgets panel</a> and add a widget to display a element on footer.'), "javascript:wp.customize.panel( 'widgets' ).focus();"),
            'default' => 'footer-copyright-social',
            'choices' => [
                'footer-copyright-social' => get_template_directory_uri() . '/core/customizer/assets/img/footer-copyright-social.png',
                'footer-copyright-menu' => get_template_directory_uri() . '/core/customizer/assets/img/footer-copyright-menu.png',
                'footer-column-3-big-first' => get_template_directory_uri() . '/core/customizer/assets/img/footer-column-3-big-first.png',
                'footer-column-3-equal' => get_template_directory_uri() . '/core/customizer/assets/img/footer-column-3-equal.png',
                'footer-column-3-big-center' => get_template_directory_uri() . '/core/customizer/assets/img/footer-column-3-big-center.png',
                'footer-column-4-equal' => get_template_directory_uri() . '/core/customizer/assets/img/footer-column-4-equal.png',
                'footer-column-4-big-first' => get_template_directory_uri() . '/core/customizer/assets/img/footer-column-4-big-first.png',
            ],
        ]);

        $this->add_field([
            'type' => 'textarea',
            'label' => __('Copyright (Support HTML tag)', 'jelajah-text'),
            'settings' => 'footer_bottom_text',
            'description' => __('You can use text map {{site_name}} {{year}}', 'jelajah-text'),
            'section' => $section,
            'default' => "@Copyright {{site_name}}. All Rights Reserved",
        ]);

        $this->add_header([
            'label' => __('Footer Styles', 'jelajah-text'),
            'section' => $section,
        ]);

        $this->add_field([
            'type' => 'color',
            'label' => __('Heading Color', 'jelajah-text'),
            'choices' => ['alpha' => true],
            'settings' => 'footer_widget_heading_color',
            'default' => rt_get_theme('color-secondary')['heading'],
            'section' => $section,
            'transport' => 'auto',
            'output' => [
                [
                    'element' => '.retheme-default-scheme .site-footer',
                    'property' => '--wp--preset--color--heading',
                ],
            ],

        ]);

        $this->add_field([
            'type' => 'color',
            'label' => __('Text Color', 'jelajah-text'),
            'choices' => ['alpha' => true],
            'settings' => 'footer_widget_color',
            'default' => rt_get_theme('color-secondary')['body'],
            'section' => $section,
            'transport' => 'auto',
            'output' => [
                [
                    'element' => '.retheme-default-scheme .site-footer',
                    'property' => '--wp--preset--color--body',
                ],
            ],
        ]);

        $this->add_field([
            'type' => 'color',
            'label' => __('Meta Color', 'jelajah-text'),
            'choices' => ['alpha' => true],
            'settings' => 'footer_widget_meta_color',
            'default' => rt_get_theme('color-secondary')['meta'],
            'section' => $section,
            'transport' => 'auto',
            'output' => [
                [
                    'element' => '.retheme-default-scheme .site-footer',
                    'property' => '--wp--preset--color--meta',
                ],
            ],

        ]);

        $this->add_field([
            'type' => 'color',
            'choices' => ['alpha' => true],
            'settings' => 'footer_widget_color_active',
            'label' => __('Accent Color', 'jelajah-text'),
            'description' => __('Text color on hover', 'jelajah-text'),
            'section' => $section,
            'default' => rt_get_theme('color-secondary')['text-link-active'],
            'transport' => 'auto',
            'output' => [
                [
                    'element' => '.retheme-default-scheme .site-footer',
                    'property' => '--wp--preset--color--text-link-active',
                ],
            ],

        ]);

        $this->add_field([
            'type' => 'color',
            'choices' => ['alpha' => true],
            'settings' => 'footer_widget_background',
            'label' => __('Background Color', 'jelajah-text'),
            'section' => $section,
            'default' => rt_get_theme('color-secondary')['background'],
            'transport' => 'auto',
            'output' => [
                [
                    'element' => '.retheme-default-scheme .site-footer',
                    'property' => '--wp--preset--color--foreground',
                ],
            ],
        ]);

        $this->add_field([
            'type' => 'color',
            'choices' => ['alpha' => true],
            'settings' => 'footer_widget_border_color',
            'label' => __('Border Color', 'jelajah-text'),
            'section' => $section,
            'default' => rt_get_theme('color-secondary')['outline'],
            'transport' => 'auto',
            'output' => [
                [
                    'element' => '.retheme-default-scheme .site-footer',
                    'property' => '--wp--preset--color--outline',
                ],
            ],
        ]);
    }

    // end class
}

new Footer;
