<?php
/**
 * Defines Excerpt settings for the Customizer.
 *
 * @package Pawfect
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

if ( ! class_exists( 'Pawfect_Options_Excerpt' ) ) :

    /**
     * The Excerpt options class.
     */
    class Pawfect_Options_Excerpt extends pawfect_Customize_Base_Option {

        /**
         * Get all the settings and controls.
         *
         * @return array
         */
        public function elements() {

            return array(

                /**
                 * Excerpt Length
                 */
                'pawfect_excerpt_length' => array(
                    'setting' => array(
                        'default'           => 30,
                        'sanitize_callback' => 'absint',
                    ),
                    'control' => array(
                        'type'        => 'number',
                        'section'     => 'pawfect_excerpt_general',
                        'label'       => esc_html__( 'Excerpt Length', 'pawfect' ),
                        'description' => esc_html__( 'Number of words for the excerpt.', 'pawfect' ),
                        'input_attrs' => array(
                            'min'   => 10,
                            'max'   => 300,
                            'step'  => 5,
                            'style' => 'width: 60px;',
                        ),
                    ),
                ),

                /**
                 * Excerpt "More" Text
                 */
                'pawfect_excerpt_more_text' => array(
                    'setting' => array(
                        'default'           => esc_html__( 'Continue reading', 'pawfect' ),
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'    => 'text',
                        'section' => 'pawfect_excerpt_general',
                        'label'   => esc_html__( '"Read More" Text', 'pawfect' ),
                    ),
                ),

            );
        }
    }

    // Instantiate the class so its settings get registered.
    // Remove automatic instantiation - let main customizer class handle this
    // new Pawfect_Options_Excerpt();

endif;
