<?php

if ( ! function_exists( 'ginevra_core_add_portfolio_list_variation_info_below' ) ) {
	/**
	 * Function that add variation layout for this module
	 *
	 * @param array $variations
	 *
	 * @return array
	 */
	function ginevra_core_add_portfolio_list_variation_info_below( $variations ) {
		$variations['info-below'] = esc_html__( 'Info Below', 'ginevra-core' );

		return $variations;
	}

	add_filter( 'ginevra_core_filter_portfolio_list_layouts', 'ginevra_core_add_portfolio_list_variation_info_below' );
}

if ( ! function_exists( 'ginevra_core_add_portfolio_list_options_info_below' ) ) {
	/**
	 * Function that add additional options for variation layout
	 *
	 * @param array $options
	 *
	 * @return array
	 */
	function ginevra_core_add_portfolio_list_options_info_below( $options ) {
		$info_below_options   = array();
		$content_option       = array(
		    'field_type' => 'select',
            'name'       => 'disable_content',
            'title'      => esc_html__('Disable Text Content', 'ginevra-core'),
            'description'   => esc_html__( 'If you set this option to “Yes”, the content below the image will not display on the page', 'ginevra-core' ),
            'options'       => ginevra_core_get_select_type_options_pool( 'no_yes', false ),
            'default_value' => 'no',
            'dependency' => array(
                'show' => array(
                    'layout' => array(
                        'values'        => 'info-below',
                        'default_value' => '',
                    ),
                ),
            ),
            'group'         => esc_html__( 'Layout', 'ginevra-core' ),
        );
		$margin_option        = array(
			'field_type' => 'text',
			'name'       => 'info_below_content_margin_top',
			'title'      => esc_html__( 'Content Top Margin', 'ginevra-core' ),
			'dependency' => array(
				'hide' => array(
					'disable_content' => array(
						'values'        => 'yes',
						'default_value' => '',
					),
				),
			),
			'group'      => esc_html__( 'Layout', 'ginevra-core' ),
		);
		$info_below_options[] = $margin_option;
		$info_below_options[] = $content_option;

		return array_merge( $options, $info_below_options );
	}

	add_filter( 'ginevra_core_filter_portfolio_list_extra_options', 'ginevra_core_add_portfolio_list_options_info_below' );
}
