diff options
author | Zach van Rijn <me@zv.io> | 2021-07-21 14:54:07 -0500 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2021-07-21 14:54:07 -0500 |
commit | 9d4123cee1867ee7199b06bdc92d40611f547ecc (patch) | |
tree | 6d864e2725242863afed1f8ba12d9c7a9bc63a69 /inc/customizer/configurations/builder/base | |
download | blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.gz blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.bz2 blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.xz blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.zip |
Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/.
Diffstat (limited to 'inc/customizer/configurations/builder/base')
3 files changed, 1147 insertions, 0 deletions
diff --git a/inc/customizer/configurations/builder/base/class-astra-button-component-configs.php b/inc/customizer/configurations/builder/base/class-astra-button-component-configs.php new file mode 100644 index 0000000..3075df5 --- /dev/null +++ b/inc/customizer/configurations/builder/base/class-astra-button-component-configs.php @@ -0,0 +1,436 @@ +<?php +/** + * Astra Theme Customizer Configuration Builder. + * + * @package astra-builder + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since 3.0.0 + */ + +// No direct access, please. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * Register Builder Customizer Configurations. + * + * @since 3.0.0 + */ +class Astra_Button_Component_Configs { + + /** + * Register Builder Customizer Configurations. + * + * @param Array $configurations Configurations. + * @param string $builder_type Builder Type. + * @param string $section Section. + * + * @since 3.0.0 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-button-' ) { + + if ( 'footer' === $builder_type ) { + $class_obj = Astra_Builder_Footer::get_instance(); + $number_of_button = Astra_Builder_Helper::$num_of_footer_button; + $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_button; + } else { + $class_obj = Astra_Builder_Header::get_instance(); + $number_of_button = Astra_Builder_Helper::$num_of_header_button; + $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_button; + } + + $button_config = array(); + + for ( $index = 1; $index <= $component_limit; $index++ ) { + + $_section = $section . $index; + $_prefix = 'button' . $index; + + /** + * These options are related to Header Section - Button. + * Prefix hs represents - Header Section. + */ + $button_config[] = array( + + /* + * Header Builder section - Button Component Configs. + */ + array( + 'name' => $_section, + 'type' => 'section', + 'priority' => 50, + /* translators: %s Index */ + 'title' => ( 1 === $number_of_button ) ? __( 'Button', 'astra' ) : sprintf( __( 'Button %s', 'astra' ), $index ), + 'panel' => 'panel-' . $builder_type . '-builder-group', + 'clone_index' => $index, + 'clone_type' => $builder_type . '-button', + ), + + /** + * Option: Header Builder Tabs + */ + array( + 'name' => $_section . '-ast-context-tabs', + 'section' => $_section, + 'type' => 'control', + 'control' => 'ast-builder-header-control', + 'priority' => 0, + 'description' => '', + + ), + + /** + * Option: Button Text + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text]', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text' ), + 'type' => 'control', + 'control' => 'text', + 'section' => $_section, + 'priority' => 20, + 'title' => __( 'Text', 'astra' ), + 'transport' => 'postMessage', + 'partial' => array( + 'selector' => '.ast-' . $builder_type . '-button-' . $index, + 'container_inclusive' => false, + 'render_callback' => array( $class_obj, 'button_' . $index ), + 'fallback_refresh' => false, + ), + 'context' => Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Button Link + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-link-option]', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-link-option' ), + 'type' => 'control', + 'control' => 'ast-link', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_link' ), + 'section' => $_section, + 'priority' => 30, + 'title' => __( 'Link', 'astra' ), + 'transport' => 'postMessage', + 'partial' => array( + 'selector' => '.ast-' . $builder_type . '-button-' . $index, + 'container_inclusive' => false, + 'render_callback' => array( $class_obj, 'button_' . $index ), + ), + 'context' => Astra_Builder_Helper::$general_tab, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Group: Primary Header Button Colors Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Text Color', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 70, + 'context' => Astra_Builder_Helper::$design_tab, + 'responsive' => true, + ), + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Background Color', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 70, + 'context' => Astra_Builder_Helper::$design_tab, + 'responsive' => true, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Button Text Color + */ + array( + 'name' => $builder_type . '-' . $_prefix . '-text-color', + 'transport' => 'postMessage', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]', + 'section' => $_section, + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 9, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Button Text Hover Color + */ + array( + 'name' => $builder_type . '-' . $_prefix . '-text-h-color', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]', + 'section' => $_section, + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 9, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Button Background Color + */ + array( + 'name' => $builder_type . '-' . $_prefix . '-back-color', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-back-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]', + 'section' => $_section, + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 10, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Button Button Hover Color + */ + array( + 'name' => $builder_type . '-' . $_prefix . '-back-h-color', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-back-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]', + 'section' => $_section, + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 10, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Button Border Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-border-size]', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-size' ), + 'type' => 'control', + 'section' => $_section, + 'control' => 'ast-border', + 'transport' => 'postMessage', + 'linked_choices' => true, + 'priority' => 79, + 'title' => __( 'Border Width', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]', + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Border Color', 'astra' ), + 'section' => $_section, + 'priority' => 80, + 'transport' => 'postMessage', + 'context' => Astra_Builder_Helper::$design_tab, + 'responsive' => true, + ), + + /** + * Option: Button Border Color + */ + array( + 'name' => $builder_type . '-' . $_prefix . '-border-color', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-color' ), + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]', + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'section' => $_section, + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 80, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Button Border Hover Color + */ + array( + 'name' => $builder_type . '-' . $_prefix . '-border-h-color', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-h-color' ), + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]', + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'section' => $_section, + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 80, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Button Border Radius + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-border-radius]', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-radius' ), + 'type' => 'control', + 'section' => $_section, + 'control' => 'ast-slider', + 'transport' => 'postMessage', + 'priority' => 80, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Border Radius', 'astra' ), + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 100, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + ); + + if ( 'footer' === $builder_type ) { + $button_config[] = array( + + array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-button-' . $index . '-alignment]', + 'default' => astra_get_option( 'footer-button-' . $index . '-alignment' ), + 'type' => 'control', + 'control' => 'ast-selector', + 'section' => $_section, + 'priority' => 35, + 'title' => __( 'Alignment', 'astra' ), + 'context' => Astra_Builder_Helper::$general_tab, + 'transport' => 'postMessage', + 'choices' => array( + 'flex-start' => 'align-left', + 'center' => 'align-center', + 'flex-end' => 'align-right', + ), + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + ), + ); + } + + if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'typography' ) ) { + $button_config[] = array( + + /** + * Option: Primary Header Button Typography + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-typography' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Font', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'context' => Astra_Builder_Helper::$design_tab, + 'priority' => 90, + ), + + /** + * Option: Primary Header Button Font Size + */ + array( + 'name' => $builder_type . '-' . $_prefix . '-font-size', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-font-size' ), + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]', + 'transport' => 'postMessage', + 'title' => __( 'Size', 'astra' ), + 'type' => 'sub-control', + 'section' => $_section, + 'control' => 'ast-responsive', + 'input_attrs' => array( + 'min' => 0, + ), + 'priority' => 2, + 'context' => Astra_Builder_Helper::$general_tab, + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + ); + } else { + $button_config[] = array( + + /** + * Option: Primary Header Button Font Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-font-size]', + 'default' => astra_get_option( $builder_type . '-' . $_prefix . '-font-size' ), + 'transport' => 'postMessage', + 'title' => __( 'Font Size', 'astra' ), + 'type' => 'control', + 'section' => $_section, + 'control' => 'ast-responsive', + 'input_attrs' => array( + 'min' => 0, + ), + 'priority' => 90, + 'context' => Astra_Builder_Helper::$design_tab, + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + ); + } + + $button_config[] = Astra_Builder_Base_Configuration::prepare_visibility_tab( $_section, $builder_type ); + + $button_config[] = Astra_Builder_Base_Configuration::prepare_advanced_tab( $_section ); + + } + + $button_config = call_user_func_array( 'array_merge', $button_config + array( array() ) ); + + $configurations = array_merge( $configurations, $button_config ); + + return $configurations; + } +} + +/** + * Kicking this off by creating object of this class. + */ + +new Astra_Button_Component_Configs(); diff --git a/inc/customizer/configurations/builder/base/class-astra-html-component-configs.php b/inc/customizer/configurations/builder/base/class-astra-html-component-configs.php new file mode 100644 index 0000000..6da0d27 --- /dev/null +++ b/inc/customizer/configurations/builder/base/class-astra-html-component-configs.php @@ -0,0 +1,231 @@ +<?php +/** + * Astra Theme Customizer Configuration Builder. + * + * @package astra-builder + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since 3.0.0 + */ + +// No direct access, please. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * Register Builder Customizer Configurations. + * + * @since 3.0.0 + */ +class Astra_Html_Component_Configs { + + /** + * Register Builder Customizer Configurations. + * + * @param Array $configurations Configurations. + * @param string $builder_type Builder Type. + * @param string $section Section. + * + * @since 3.0.0 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-html-' ) { + + $html_config = array(); + + if ( 'footer' === $builder_type ) { + $class_obj = Astra_Builder_Footer::get_instance(); + $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_html; + } else { + $class_obj = Astra_Builder_Header::get_instance(); + $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_html; + } + + for ( $index = 1; $index <= $component_limit; $index++ ) { + + $_section = $section . $index; + + $_configs = array( + + /** + * Option: Builder Tabs + */ + array( + 'name' => $_section . '-ast-context-tabs', + 'section' => $_section, + 'type' => 'control', + 'control' => 'ast-builder-header-control', + 'priority' => 0, + 'description' => '', + ), + + /* + * Builder section + */ + array( + 'name' => $_section, + 'type' => 'section', + 'priority' => 60, + /* translators: %s Index */ + 'title' => sprintf( __( 'HTML %s', 'astra' ), $index ), + 'panel' => 'panel-' . $builder_type . '-builder-group', + 'clone_index' => $index, + 'clone_type' => $builder_type . '-html', + ), + + /** + * Option: Html Editor. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-html-' . $index . ']', + 'type' => 'control', + 'control' => 'ast-html-editor', + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 4, + 'default' => astra_get_option( $builder_type . '-html-' . $index ), + 'input_attrs' => array( + 'id' => $builder_type . '-html-' . $index, + ), + 'partial' => array( + 'selector' => '.ast-' . $builder_type . '-html-' . $index, + 'render_callback' => array( $class_obj, $builder_type . '_html_' . $index ), + 'fallback_refresh' => false, + ), + 'context' => Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: HTML Color. + */ + + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-html-' . $index . 'color]', + 'default' => astra_get_option( $builder_type . '-html-' . $index . 'color' ), + 'type' => 'control', + 'section' => $_section, + 'priority' => 8, + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'title' => __( 'Text Color', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-html-' . $index . '-link-group]', + 'default' => astra_get_option( $builder_type . '-html-' . $index . '-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Link Color', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 8, + 'context' => Astra_Builder_Helper::$design_tab, + 'responsive' => true, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Link Color. + */ + array( + 'name' => $builder_type . '-html-' . $index . 'link-color', + 'default' => astra_get_option( $builder_type . '-html-' . $index . 'link-color' ), + 'type' => 'sub-control', + 'section' => $_section, + 'priority' => 9, + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-html-' . $index . '-link-group]', + 'title' => __( 'Normal', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + + /** + * Option: Link Hover Color. + */ + array( + 'name' => $builder_type . '-html-' . $index . 'link-h-color', + 'default' => astra_get_option( $builder_type . '-html-' . $index . 'link-h-color' ), + 'type' => 'sub-control', + 'section' => $_section, + 'priority' => 10, + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-html-' . $index . '-link-group]', + 'title' => __( 'Hover', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + + /** + * Option: Margin Space + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $_section . '-margin]', + 'default' => astra_get_option( $_section . '-margin' ), + 'type' => 'control', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-spacing', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), + 'section' => $_section, + 'priority' => 220, + 'title' => __( 'Margin', 'astra' ), + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + 'linked_choices' => true, + 'unit_choices' => array( 'px', 'em', '%' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + ); + + if ( 'footer' === $builder_type ) { + $_configs[] = array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-html-' . $index . '-alignment]', + 'default' => astra_get_option( 'footer-html-' . $index . '-alignment' ), + 'type' => 'control', + 'control' => 'ast-selector', + 'section' => $_section, + 'priority' => 6, + 'title' => __( 'Alignment', 'astra' ), + 'context' => Astra_Builder_Helper::$general_tab, + 'transport' => 'postMessage', + 'choices' => array( + 'left' => 'align-left', + 'center' => 'align-center', + 'right' => 'align-right', + ), + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + ); + } + + $html_config[] = Astra_Builder_Base_Configuration::prepare_visibility_tab( $_section, $builder_type ); + + $html_config[] = Astra_Builder_Base_Configuration::prepare_typography_options( $_section ); + + $html_config[] = $_configs; + } + + $html_config = call_user_func_array( 'array_merge', $html_config + array( array() ) ); + $configurations = array_merge( $configurations, $html_config ); + + return $configurations; + } +} + +/** + * Kicking this off by creating object of this class. + */ + +new Astra_Html_Component_Configs(); diff --git a/inc/customizer/configurations/builder/base/class-astra-social-icon-component-configs.php b/inc/customizer/configurations/builder/base/class-astra-social-icon-component-configs.php new file mode 100644 index 0000000..91e8006 --- /dev/null +++ b/inc/customizer/configurations/builder/base/class-astra-social-icon-component-configs.php @@ -0,0 +1,480 @@ +<?php +/** + * Astra Theme Customizer Configuration Builder. + * + * @package astra-builder + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since 3.0.0 + */ + +// No direct access, please. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * Register Builder Customizer Configurations. + * + * @since 3.0.0 + */ +class Astra_Social_Icon_Component_Configs { + + /** + * Register Builder Customizer Configurations. + * + * @param Array $configurations Configurations. + * @param string $builder_type Builder Type. + * @param string $section Section slug. + * @since 3.0.0 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-social-icons-' ) { + + $social_configs = array(); + + $class_obj = Astra_Builder_Header::get_instance(); + $number_of_social_icons = Astra_Builder_Helper::$num_of_header_social_icons; + + if ( 'footer' === $builder_type ) { + $class_obj = Astra_Builder_Footer::get_instance(); + $number_of_social_icons = Astra_Builder_Helper::$num_of_footer_social_icons; + $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_social_icons; + } else { + $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_social_icons; + } + + for ( $index = 1; $index <= $component_limit; $index++ ) { + + $_section = $section . $index; + + $_configs = array( + + /* + * Builder section + */ + array( + 'name' => $_section, + 'type' => 'section', + 'priority' => 90, + /* translators: 1: index */ + 'title' => ( 1 === $number_of_social_icons ) ? __( 'Social Icons', 'astra' ) : sprintf( __( 'Social Icons %s', 'astra' ), $index ), + 'panel' => 'panel-' . $builder_type . '-builder-group', + 'clone_index' => $index, + 'clone_type' => $builder_type . '-social-icons', + ), + + /** + * Option: Builder Tabs + */ + array( + 'name' => $_section . '-ast-context-tabs', + 'section' => $_section, + 'type' => 'control', + 'control' => 'ast-builder-header-control', + 'priority' => 0, + 'description' => '', + ), + + /** + * Option: Social Icons. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-icons-' . $index . ']', + 'section' => $_section, + 'type' => 'control', + 'control' => 'ast-social-icons', + 'title' => __( 'Social Icons', 'astra' ), + 'transport' => 'postMessage', + 'priority' => 1, + 'default' => astra_get_option( $builder_type . '-social-icons-' . $index ), + 'partial' => array( + 'selector' => '.ast-' . $builder_type . '-social-' . $index . '-wrap', + 'container_inclusive' => true, + 'render_callback' => array( $class_obj, $builder_type . '_social_' . $index ), + 'fallback_refresh' => false, + ), + 'context' => Astra_Builder_Helper::$general_tab, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + // Show label Toggle. + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-label-toggle]', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-label-toggle' ), + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'section' => $_section, + 'priority' => 2, + 'title' => __( 'Show Label', 'astra' ), + 'transport' => 'postMessage', + 'partial' => array( + 'selector' => '.ast-' . $builder_type . '-social-' . $index . '-wrap', + 'container_inclusive' => true, + 'render_callback' => array( $class_obj, $builder_type . '_social_' . $index ), + 'fallback_refresh' => false, + ), + 'context' => Astra_Builder_Helper::$general_tab, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Social Icon Spacing + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-space]', + 'section' => $_section, + 'priority' => 2, + 'transport' => 'postMessage', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-space' ), + 'title' => __( 'Icon Spacing', 'astra' ), + 'suffix' => 'px', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 50, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + + + /** + * Option: Social Icon Background Spacing. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-bg-space]', + 'section' => $_section, + 'priority' => 2, + 'transport' => 'postMessage', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-bg-space' ), + 'title' => __( 'Icon Background Spacing', 'astra' ), + 'suffix' => 'px', + 'type' => 'control', + 'control' => 'ast-slider', + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 50, + ), + 'context' => Astra_Builder_Helper::$design_tab, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + + /** + * Option: Social Icon Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-size]', + 'section' => $_section, + 'priority' => 1, + 'transport' => 'postMessage', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-size' ), + 'title' => __( 'Icon Size', 'astra' ), + 'suffix' => 'px', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 50, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + + /** + * Option: Social Icon Radius + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-radius]', + 'section' => $_section, + 'priority' => 4, + 'transport' => 'postMessage', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-radius' ), + 'title' => __( 'Icon Radius', 'astra' ), + 'suffix' => 'px', + 'type' => 'control', + 'control' => 'ast-slider', + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 50, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-color-type]', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-color-type' ), + 'section' => $_section, + 'type' => 'control', + 'control' => 'ast-selector', + 'title' => __( 'Color Type', 'astra' ), + 'priority' => 8, + 'choices' => array( + 'custom' => __( 'Custom', 'astra' ), + 'official' => __( 'Official', 'astra' ), + ), + 'transport' => 'postMessage', + 'context' => Astra_Builder_Helper::$design_tab, + 'responsive' => false, + 'renderAs' => 'text', + ), + + /** + * Group: Primary Social Colors Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-icon-color-group]', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Icon Color', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 9, + 'context' => array( + Astra_Builder_Helper::$design_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-color-type]', + 'operator' => '==', + 'value' => 'custom', + ), + ), + 'responsive' => true, + ), + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-label-color-group]', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Label Color', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 9, + 'context' => array( + Astra_Builder_Helper::$design_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-color-type]', + 'operator' => '==', + 'value' => 'custom', + ), + ), + 'responsive' => true, + ), + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-background-color-group]', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-color-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Background Color', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 9, + 'context' => array( + Astra_Builder_Helper::$design_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-color-type]', + 'operator' => '==', + 'value' => 'custom', + ), + ), + 'responsive' => true, + ), + + /** + * Option: Social Text Color + */ + array( + 'name' => $builder_type . '-social-' . $index . '-color', + 'transport' => 'postMessage', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-icon-color-group]', + 'section' => $_section, + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 5, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Social Text Hover Color + */ + array( + 'name' => $builder_type . '-social-' . $index . '-h-color', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-icon-color-group]', + 'section' => $_section, + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 7, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Social Label Color + */ + array( + 'name' => $builder_type . '-social-' . $index . '-label-color', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-label-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-label-color-group]', + 'section' => $_section, + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 8, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Social Label Hover Color + */ + array( + 'name' => $builder_type . '-social-' . $index . '-label-h-color', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-label-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-label-color-group]', + 'section' => $_section, + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 8, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Social Background Color + */ + array( + 'name' => $builder_type . '-social-' . $index . '-bg-color', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-bg-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-background-color-group]', + 'section' => $_section, + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 9, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Social Background Hover Color + */ + array( + 'name' => $builder_type . '-social-' . $index . '-bg-h-color', + 'default' => astra_get_option( $builder_type . '-social-' . $index . '-bg-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-background-color-group]', + 'section' => $_section, + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 11, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Margin Space + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[' . $_section . '-margin]', + 'default' => astra_get_option( $_section . '-margin' ), + 'type' => 'control', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-spacing', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), + 'section' => $_section, + 'priority' => 220, + 'title' => __( 'Margin', 'astra' ), + 'linked_choices' => true, + 'unit_choices' => array( 'px', 'em', '%' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + ); + + if ( 'footer' === $builder_type ) { + + $_configs[] = array( + 'name' => ASTRA_THEME_SETTINGS . '[footer-social-' . $index . '-alignment]', + 'default' => astra_get_option( 'footer-social-' . $index . '-alignment' ), + 'type' => 'control', + 'control' => 'ast-selector', + 'section' => $_section, + 'priority' => 6, + 'title' => __( 'Alignment', 'astra' ), + 'context' => Astra_Builder_Helper::$general_tab, + 'transport' => 'postMessage', + 'choices' => array( + 'left' => 'align-left', + 'center' => 'align-center', + 'right' => 'align-right', + ), + ); + } + + $social_configs[] = Astra_Builder_Base_Configuration::prepare_visibility_tab( $_section, $builder_type ); + + $social_configs[] = Astra_Builder_Base_Configuration::prepare_typography_options( + $_section, + array( + Astra_Builder_Helper::$design_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-social-' . $index . '-label-toggle]', + 'operator' => '===', + 'value' => true, + ), + ) + ); + + $social_configs[] = $_configs; + } + + $social_configs = call_user_func_array( 'array_merge', $social_configs + array( array() ) ); + $configurations = array_merge( $configurations, $social_configs ); + + return $configurations; + } +} + +/** + * Kicking this off by creating object of this class. + */ + +new Astra_Social_Icon_Component_Configs(); |