Astra_Update_Body_Font::execute( array $args )
Execute the ability.
Description
Parameters
- $args
-
(array) (Required) Input arguments.
Return
(array) Result array.
Source
File: inc/abilities/customizer/globals/typography/class-astra-update-body-font.php
public function execute( $args ) {
if ( isset( $args['font_family'] ) ) {
$font_family = sanitize_text_field( $args['font_family'] );
$formatted_font = "'" . $font_family . "', sans-serif";
astra_update_option( 'body-font-family', $formatted_font );
}
if ( isset( $args['font_weight'] ) ) {
astra_update_option( 'body-font-weight', sanitize_text_field( $args['font_weight'] ) );
}
if ( isset( $args['font_size'] ) && is_array( $args['font_size'] ) ) {
$existing = astra_get_option( 'font-size-body', array() );
$merged = array_merge( $existing, $args['font_size'] );
astra_update_option( 'font-size-body', Astra_Abilities_Helper::sanitize_responsive_typo( $merged ) );
}
Astra_Abilities_Helper::update_font_extras( $args, 'body-font-extras' );
return Astra_Abilities_Response::success(
__( 'Body font settings updated successfully.', 'astra' ),
array(
'font_family' => astra_get_option( 'body-font-family', '' ),
'font_weight' => astra_get_option( 'body-font-weight', '' ),
'font_size' => astra_get_option( 'font-size-body', array() ),
'font_extras' => astra_get_option( 'body-font-extras', array() ),
)
);
}
Expand full source code Collapse full source code View on Trac