static function filterDefaults( $defaults ) {

		// SASS => WP
		$overrides = [
			'body-font-size' => 'pdf_body_font_size',
			'body-line-height' => 'pdf_body_line_height',
			'page-margin-top' => 'pdf_page_margin_top',
			'page-margin-inside' => 'pdf_page_margin_inside',
			'page-margin-bottom' => 'pdf_page_margin_bottom',
			'page-margin-outside' => 'pdf_page_margin_outside',
			'front-matter-running-content-left' => 'running_content_front_matter_left',
			'front-matter-running-content-right' => 'running_content_front_matter_right',
			'introduction-running-content-left' => 'running_content_introduction_left',
			'introduction-running-content-right' => 'running_content_introduction_right',
			'part-running-content-left' => 'running_content_part_left',
			'part-running-content-right' => 'running_content_part_right',
			'chapter-running-content-left' => 'running_content_chapter_left',
			'chapter-running-content-right' => 'running_content_chapter_right',
			'back-matter-running-content-left' => 'running_content_back_matter_left',
			'back-matter-running-content-right' => 'running_content_back_matter_right',
		];

		$transient_name = 'pressbooks_theme_options_pdf_parsed_sass_variables';
		$parsed_sass_variables = get_transient( $transient_name );
		if ( $parsed_sass_variables === false ) {
			// Order of files matter. If a variable is duplicated in other files then the last one takes precedence
			$parsed_sass_variables = [];
			$sass = Container::get( 'Sass' );
			$path_to_global = $sass->pathToGlobals();
			$path_to_theme = get_stylesheet_directory();
			$files = [
				$path_to_global . '/variables/_elements.scss',
				$path_to_global . '/variables/_structure.scss',
				$path_to_theme . '/assets/styles/components/_elements.scss',
				$path_to_theme . '/assets/styles/components/_structure.scss',
			];
			foreach ( $files as $file ) {
				if ( file_exists( $file ) ) {
					$parsed_sass_variables[] = $sass->parseVariables( \Pressbooks\Utility\get_contents( $file ) );
				}
			}
			set_transient( $transient_name, $parsed_sass_variables );
		}

		foreach ( $parsed_sass_variables as $parsed_variables ) {
			foreach ( $overrides as $sass_var => $wp_option ) {
				if ( isset( $parsed_variables[ $sass_var ] ) ) {
					$val = self::parseSassValue( $parsed_variables[ $sass_var ] );
					if ( ! empty( $val ) ) {
						if ( in_array( $wp_option, self::getFloatOptions(), true ) ) {
							$val = (float) preg_replace( '/[^0-9.]/', '', $val ); // Extract digits and periods
						} elseif ( in_array( $wp_option, self::getIntegerOptions(), true ) ) {
							$val = (int) preg_replace( '/[^0-9]/', '', $val ); // Extract digits
						} elseif ( in_array( $wp_option, self::getBooleanOptions(), true ) ) {
							$val = filter_var( $val, FILTER_VALIDATE_BOOLEAN ); // Convert to boolean
						} elseif ( strpos( $wp_option, 'running_content', true ) ) {
							$val = self::replaceRunningContentStrings( $val );
						}
						$defaults[ $wp_option ] = $val; // Override default with new value
					}
				}
			}
		}

		return $defaults;
	}
static function filterDefaults( $defaults ) {

		// SASS => WP
		$overrides = [
			'body-font-size' => 'pdf_body_font_size',
			'body-line-height' => 'pdf_body_line_height',
			'page-margin-top' => 'pdf_page_margin_top',
			'page-margin-inside' => 'pdf_page_margin_inside',
			'page-margin-bottom' => 'pdf_page_margin_bottom',
			'page-margin-outside' => 'pdf_page_margin_outside',
			'front-matter-running-content-left' => 'running_content_front_matter_left',
			'front-matter-running-content-right' => 'running_content_front_matter_right',
			'introduction-running-content-left' => 'running_content_introduction_left',
			'introduction-running-content-right' => 'running_content_introduction_right',
			'part-running-content-left' => 'running_content_part_left',
			'part-running-content-right' => 'running_content_part_right',
			'chapter-running-content-left' => 'running_content_chapter_left',
			'chapter-running-content-right' => 'running_content_chapter_right',
			'back-matter-running-content-left' => 'running_content_back_matter_left',
			'back-matter-running-content-right' => 'running_content_back_matter_right',
		];

		$transient_name = 'pressbooks_theme_options_pdf_parsed_sass_variables';
		$parsed_sass_variables = get_transient( $transient_name );
		if ( $parsed_sass_variables === false ) {
			// Order of files matter. If a variable is duplicated in other files then the last one takes precedence
			$parsed_sass_variables = [];
			$sass = Container::get( 'Sass' );
			$path_to_global = $sass->pathToGlobals();
			$path_to_theme = get_stylesheet_directory();
			$files = [
				$path_to_global . '/variables/_elements.scss',
				$path_to_global . '/variables/_structure.scss',
				$path_to_theme . '/assets/styles/components/_elements.scss',
				$path_to_theme . '/assets/styles/components/_structure.scss',
			];
			foreach ( $files as $file ) {
				if ( file_exists( $file ) ) {
					$parsed_sass_variables[] = $sass->parseVariables( \Pressbooks\Utility\get_contents( $file ) );
				}
			}
			set_transient( $transient_name, $parsed_sass_variables );
		}

		foreach ( $parsed_sass_variables as $parsed_variables ) {
			foreach ( $overrides as $sass_var => $wp_option ) {
				if ( isset( $parsed_variables[ $sass_var ] ) ) {
					$val = self::parseSassValue( $parsed_variables[ $sass_var ] );
					if ( ! empty( $val ) ) {
						if ( in_array( $wp_option, self::getFloatOptions(), true ) ) {
							$val = (float) preg_replace( '/[^0-9.]/', '', $val ); // Extract digits and periods
						} elseif ( in_array( $wp_option, self::getIntegerOptions(), true ) ) {
							$val = (int) preg_replace( '/[^0-9]/', '', $val ); // Extract digits
						} elseif ( in_array( $wp_option, self::getBooleanOptions(), true ) ) {
							$val = filter_var( $val, FILTER_VALIDATE_BOOLEAN ); // Convert to boolean
						} elseif ( strpos( $wp_option, 'running_content', true ) ) {
							$val = self::replaceRunningContentStrings( $val );
						}
						$defaults[ $wp_option ] = $val; // Override default with new value
					}
				}
			}
		}

		return $defaults;
	}
static function filterDefaults ( $ defaults ) { // SASS => WP $ overrides = [ 'body-font-size' => 'pdf_body_font_size' , 'body-line-height' => 'pdf_body_line_height' , 'page-margin-top' => 'pdf_page_margin_top' , 'page-margin-inside' => 'pdf_page_margin_inside' , 'page-margin-bottom' => 'pdf_page_margin_bottom' , 'page-margin-outside' => 'pdf_page_margin_outside' , 'front-matter-running-content-left' => 'running_content_front_matter_left' , 'front-matter-running-content-right' => 'running_content_front_matter_right' , 'introduction-running-content-left' => 'running_content_introduction_left' , 'introduction-running-content-right' => 'running_content_introduction_right' , 'part-running-content-left' => 'running_content_part_left' , 'part-running-content-right' => 'running_content_part_right' , 'chapter-running-content-left' => 'running_content_chapter_left' , 'chapter-running-content-right' => 'running_content_chapter_right' , 'back-matter-running-content-left' => 'running_content_back_matter_left' , 'back-matter-running-content-right' => 'running_content_back_matter_right' , ] ; $ transient_name = 'pressbooks_theme_options_pdf_parsed_sass_variables' ; $ parsed_sass_variables = get_transient ( $ transient_name ) ; if ( $ parsed_sass_variables === false ) { // Order of files matter. If a variable is duplicated in other files then the last one takes precedence $ parsed_sass_variables = [ ] ; $ sass = Container :: get ( 'Sass' ) ; $ path_to_global = $ sass -> pathToGlobals ( ) ; $ path_to_theme = get_stylesheet_directory ( ) ; $ files = [ $ path_to_global . '/variables/_elements.scss' , $ path_to_global . '/variables/_structure.scss' , $ path_to_theme . '/assets/styles/components/_elements.scss' , $ path_to_theme . '/assets/styles/components/_structure.scss' , ] ; foreach ( $ files as $ file ) { if ( file_exists ( $ file ) ) { $ parsed_sass_variables [ ] = $ sass -> parseVariables ( \ Pressbooks \ Utility \ get_contents ( $ file ) ) ; } } set_transient ( $ transient_name , $ parsed_sass_variables ) ; } foreach ( $ parsed_sass_variables as $ parsed_variables ) { foreach ( $ overrides as $ sass_var => $ wp_option ) { if ( isset ( $ parsed_variables [ $ sass_var ] ) ) { $ val = self :: parseSassValue ( $ parsed_variables [ $ sass_var ] ) ; if ( ! empty ( $ val ) ) { if ( in_array ( $ wp_option , self :: getFloatOptions ( ) , true ) ) { $ val = ( float ) preg_replace ( '/[^0-9.]/' , '' , $ val ) ; // Extract digits and periods } elseif ( in_array ( $ wp_option , self :: getIntegerOptions ( ) , true ) ) { $ val = ( int ) preg_replace ( '/[^0-9]/' , '' , $ val ) ; // Extract digits } elseif ( in_array ( $ wp_option , self :: getBooleanOptions ( ) , true ) ) { $ val = filter_var ( $ val , FILTER_VALIDATE_BOOLEAN ) ; // Convert to boolean } elseif ( strpos ( $ wp_option , 'running_content' , true ) ) { $ val = self :: replaceRunningContentStrings ( $ val ) ; } $ defaults [ $ wp_option ] = $ val ; // Override default with new value } } } } return $ defaults ; }
Filter the array of default values for the PDF options tab.

@param array $defaults

@return array $defaults
Filter the array of default values for the PDF options tab .