Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docblocks to hooks used in customizer class. #2038

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 190 additions & 4 deletions inc/customizer/class-storefront-customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ public function __construct() {
* @return array
*/
public function get_storefront_default_setting_values() {
/**
* Filters for the default Storefront Options.
*
* @param array $args
* @package storefront
* @since 2.0.0
*/
return apply_filters(
'storefront_setting_default_values',
$args = array(
Expand Down Expand Up @@ -163,6 +170,13 @@ public function customize_register( $wp_customize ) {
require_once dirname( __FILE__ ) . '/class-storefront-customizer-control-radio-image.php';
require_once dirname( __FILE__ ) . '/class-storefront-customizer-control-arbitrary.php';

/**
* Filter for including additional custom controls.
*
* @param boolean Include control file.
* @package storefront
* @since 2.0.0
*/
if ( apply_filters( 'storefront_customizer_more', true ) ) {
require_once dirname( __FILE__ ) . '/class-storefront-customizer-control-more.php';
}
Expand All @@ -184,6 +198,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_heading_color',
array(
/**
* Filters for modifying the default heading color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_heading_color', '#484c51' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -208,6 +229,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_text_color',
array(
/**
* Filters for modifying the default text color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_text_color', '#43454b' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -232,6 +260,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_accent_color',
array(
/**
* Filters for modifying the default accent color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_accent_color', '#7f54b3' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -256,6 +291,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_hero_heading_color',
array(
/**
* Filters for modifying the default hero heading color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_hero_heading_color', '#000000' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -280,6 +322,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_hero_text_color',
array(
/**
* Filters for modifying the default hero text color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_hero_text_color', '#000000' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand Down Expand Up @@ -317,6 +366,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_header_background_color',
array(
/**
* Filters for modifying the default header background color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_header_background_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -341,6 +397,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_header_text_color',
array(
/**
* Filters for modifying the default header text color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_header_text_color', '#9aa0a7' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -365,6 +428,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_header_link_color',
array(
/**
* Filters for modifying the default header link color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_header_link_color', '#d5d9db' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand Down Expand Up @@ -401,6 +471,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_footer_background_color',
array(
/**
* Filters for modifying the default footer background color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_footer_background_color', '#f0f0f0' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -425,6 +502,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_footer_heading_color',
array(
/**
* Filters for modifying the default footer heading color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_footer_heading_color', '#494c50' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -449,6 +533,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_footer_text_color',
array(
/**
* Filters for modifying the default footer text color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_footer_text_color', '#61656b' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -473,6 +564,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_footer_link_color',
array(
/**
* Filters for modifying the default footer link color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_footer_link_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand Down Expand Up @@ -509,6 +607,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_button_background_color',
array(
/**
* Filters for modifying the default button background color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_button_background_color', '#96588a' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -533,6 +638,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_button_text_color',
array(
/**
* Filters for modifying the default button text color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_button_text_color', '#ffffff' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -557,6 +669,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_button_alt_background_color',
array(
/**
* Filters for modifying the default button alt background color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_button_alt_background_color', '#2c2d33' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand All @@ -581,6 +700,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_button_alt_text_color',
array(
/**
* Filters for modifying the default button alt text color.
*
* @param string Hex color value.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_button_alt_text_color', '#ffffff' ),
'sanitize_callback' => 'sanitize_hex_color',
)
Expand Down Expand Up @@ -613,6 +739,13 @@ public function customize_register( $wp_customize ) {
$wp_customize->add_setting(
'storefront_layout',
array(
/**
* Filters for modifying the default layout.
*
* @param string left/right based on RTL.
* @package storefront
* @since 2.0.0
*/
'default' => apply_filters( 'storefront_default_layout', $layout = is_rtl() ? 'left' : 'right' ),
'sanitize_callback' => 'storefront_sanitize_choices',
)
Expand All @@ -636,7 +769,11 @@ public function customize_register( $wp_customize ) {
);

/**
* More
* Filter for including additional custom controls.
*
* @param boolean Add additional sections.
* @package storefront
* @since 2.0.0
*/
if ( apply_filters( 'storefront_customizer_more', true ) ) {
$wp_customize->add_section(
Expand Down Expand Up @@ -696,6 +833,13 @@ public function get_storefront_theme_mods() {
'button_alt_text_color' => get_theme_mod( 'storefront_button_alt_text_color' ),
);

/**
* Filters for Storefront Theme Mods.
*
* @param array Associative array of theme mods for color options.
* @package storefront
* @since 2.0.0
*/
return apply_filters( 'storefront_theme_mods', $storefront_theme_mods );
}

Expand All @@ -707,8 +851,22 @@ public function get_storefront_theme_mods() {
*/
public function get_css() {
$storefront_theme_mods = $this->get_storefront_theme_mods();
$brighten_factor = apply_filters( 'storefront_brighten_factor', 25 );
$darken_factor = apply_filters( 'storefront_darken_factor', -25 );
/**
* Filters for brightening color value.
*
* @param int Numerical value for brighten amount.
* @package storefront
* @since 2.0.0
*/
$brighten_factor = apply_filters( 'storefront_brighten_factor', 25 );
/**
* Filters for darkening color value.
*
* @param int Numerical value for darken amount.
* @package storefront
* @since 2.0.0
*/
$darken_factor = apply_filters( 'storefront_darken_factor', -25 );

$styles = '
.main-navigation ul li a,
Expand Down Expand Up @@ -889,6 +1047,13 @@ public function get_css() {
}
}';

/**
* Filters for Storefront Customizer CSS.
*
* @param object Object of CSS rulesets.
* @package storefront
* @since 2.0.0
*/
return apply_filters( 'storefront_customizer_css', $styles );
}

Expand All @@ -900,7 +1065,14 @@ public function get_css() {
*/
public function gutenberg_get_css() {
$storefront_theme_mods = $this->get_storefront_theme_mods();
$darken_factor = apply_filters( 'storefront_darken_factor', -25 );
/**
* Filters for darkening color value.
*
* @param int Numerical value for darken amount.
* @package storefront
* @since 2.0.0
*/
$darken_factor = apply_filters( 'storefront_darken_factor', -25 );

// Gutenberg.
$styles = '
Expand Down Expand Up @@ -1021,6 +1193,13 @@ public function gutenberg_get_css() {
}
';

/**
* Filters for Gutenberg Customizer CSS.
*
* @param object Object of CSS rulesets.
* @package storefront
* @since 2.0.0
*/
return apply_filters( 'storefront_gutenberg_customizer_css', $styles );
}

Expand Down Expand Up @@ -1088,6 +1267,13 @@ public function block_editor_customizer_css() {

$styles .= $this->gutenberg_get_css();

/**
* Filters for Gutenberg Block Editor Customizer CSS.
*
* @param object Object of CSS rulesets.
* @package storefront
* @since 2.0.0
*/
wp_add_inline_style( 'storefront-gutenberg-blocks', apply_filters( 'storefront_gutenberg_block_editor_customizer_css', $styles ) );
}

Expand Down