Astra_Addon_Button_Component_Configs
Register Button Customizer Configurations.
Description
Source
File: classes/builder/type/base/configurations/class-astra-addon-button-component-configs.php
class Astra_Addon_Button_Component_Configs {
/**
* Register Button Customizer Configurations.
*
* @param Array $configurations Configurations.
* @param string $builder_type Builder Type.
* @param string $section Section.
*
* @since 3.1.0
* @return Array Astra Customizer Configurations with updated configurations.
*/
public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-button-' ) {
$class_obj = '';
if ( 'footer' === $builder_type && class_exists( 'Astra_Builder_Footer' ) ) {
$class_obj = Astra_Builder_Footer::get_instance();
} elseif ( 'header' === $builder_type && class_exists( 'Astra_Builder_Header' ) ) {
$class_obj = Astra_Builder_Header::get_instance();
}
$html_config = array();
$component_limit = astra_addon_builder_helper()->component_limit;
for ( $index = 1; $index <= $component_limit; $index++ ) {
$_section = $section . $index;
$_prefix = 'button' . $index;
$_configs = array(
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-size]',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-size' ),
'type' => 'control',
'control' => 'ast-select',
'section' => $_section,
'priority' => 30,
'title' => __( 'Size', 'astra-addon' ),
'choices' => array(
'xs' => __( 'Extra Small', 'astra-addon' ),
'sm' => __( 'Small', 'astra-addon' ),
'md' => __( 'Medium', 'astra-addon' ),
'lg' => __( 'Large', 'astra-addon' ),
'xl' => __( 'Extra Large', 'astra-addon' ),
),
'transport' => 'postMessage',
'context' => astra_addon_builder_helper()->general_tab,
'partial' => array(
'selector' => '.ast-' . $builder_type . '-button-' . $index,
'container_inclusive' => false,
'render_callback' => array( $class_obj, 'button_' . $index ),
'fallback_refresh' => false,
),
),
);
$html_config[] = Astra_Addon_Base_Configs::prepare_box_shadow_tab( $_section, $builder_type . '-' . $_prefix );
$html_config[] = $_configs;
}
$html_config = call_user_func_array( 'array_merge', $html_config + array( array() ) );
return array_merge( $configurations, $html_config );
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
Methods
- register_configuration — Register Button Customizer Configurations.