@@ -526,6 +526,8 @@ private static function get_slug_from_attribute( $duotone_attr ) {
526526 /**
527527 * Checks if we have a valid duotone preset.
528528 *
529+ * Valid presets are defined in the $global_styles_presets array.
530+ *
529531 * @internal
530532 *
531533 * @param string $duotone_attr The duotone attribute from a block.
@@ -541,6 +543,9 @@ private static function is_preset( $duotone_attr ) {
541543 /**
542544 * Gets the CSS variable name for a duotone preset.
543545 *
546+ * Example output:
547+ * --wp--preset--duotone--blue-orange
548+ *
544549 * @internal
545550 *
546551 * @param string $slug The slug of the duotone preset.
@@ -553,6 +558,9 @@ private static function get_css_custom_property_name( $slug ) {
553558 /**
554559 * Get the ID of the duotone filter.
555560 *
561+ * Example output:
562+ * wp-duotone-blue-orange
563+ *
556564 * @internal
557565 *
558566 * @param string $slug The slug of the duotone preset.
@@ -565,6 +573,9 @@ private static function get_filter_id( $slug ) {
565573 /**
566574 * Get the CSS variable for a duotone preset.
567575 *
576+ * Example output:
577+ * var(--wp--preset--duotone--blue-orange)
578+ *
568579 * @internal
569580 *
570581 * @param string $slug The slug of the duotone preset.
@@ -578,6 +589,9 @@ private static function get_css_var( $slug ) {
578589 /**
579590 * Get the URL for a duotone filter.
580591 *
592+ * Example output:
593+ * url(#wp-duotone-blue-orange)
594+ *
581595 * @internal
582596 *
583597 * @param string $filter_id The ID of the filter.
@@ -590,6 +604,8 @@ private static function get_filter_url( $filter_id ) {
590604 /**
591605 * Gets the SVG for the duotone filter definition.
592606 *
607+ * Whitespace is removed when SCRIPT_DEBUG is not enabled.
608+ *
593609 * @internal
594610 *
595611 * @param string $filter_id The ID of the filter.
@@ -762,6 +778,8 @@ private static function get_global_styles_presets( $sources ) {
762778 /**
763779 * Enqueue a block CSS declaration for the page.
764780 *
781+ * This does not include any SVGs.
782+ *
765783 * @internal
766784 *
767785 * @param string $filter_id The filter ID. e.g. 'wp-duotone-000000-ffffff-2'.
@@ -837,6 +855,8 @@ private static function enqueue_global_styles_preset( $filter_id, $duotone_selec
837855 /**
838856 * Registers the style and colors block attributes for block types that support it.
839857 *
858+ * Block support is added with `supports.filter.duotone` in block.json.
859+ *
840860 * @since 6.3.0
841861 *
842862 * @param WP_Block_Type $block_type Block Type.
@@ -867,6 +887,9 @@ public static function register_duotone_support( $block_type ) {
867887 /**
868888 * Get the CSS selector for a block type.
869889 *
890+ * This handles selectors defined in `color.__experimentalDuotone` support
891+ * if `filter.duotone` support is not defined.
892+ *
870893 * @param string $block_name The block name.
871894 *
872895 * @internal
@@ -907,10 +930,11 @@ private static function get_selector( $block_name ) {
907930 }
908931
909932 /**
910- * Get all possible duotone presets from global and theme styles.
933+ * Scrape all possible duotone presets from global and theme styles and
934+ * store them in self::$global_styles_presets.
911935 *
912- * Store each item as slug => [ colors array ]
913- * We only want to process this one time. On block render we'll access and output only the needed presets for that page .
936+ * Used in conjunction with self::render_duotone_support for blocks that
937+ * use duotone preset filters .
914938 *
915939 * @since 6.3.0
916940 */
@@ -929,7 +953,10 @@ public static function set_global_styles_presets() {
929953 }
930954
931955 /**
932- * Scrape all block names from global styles and store in self::$global_styles_block_names
956+ * Scrape all block names from global styles and store in self::$global_styles_block_names.
957+ *
958+ * Used in conjunction with self::render_duotone_support to output the
959+ * duotone filters defined in the theme.json global styles.
933960 *
934961 * @since 6.3.0
935962 */
@@ -964,6 +991,9 @@ public static function set_global_style_block_names() {
964991 /**
965992 * Render out the duotone CSS styles and SVG.
966993 *
994+ * The hooks self::set_global_style_block_names and self::set_global_styles_presets
995+ * must be called before this function.
996+ *
967997 * @since 6.3.0
968998 *
969999 * @param string $block_content Rendered block content.
@@ -1048,6 +1078,8 @@ public static function render_duotone_support( $block_content, $block ) {
10481078 /**
10491079 * Appends the used block duotone filter declarations to the inline block supports CSS.
10501080 *
1081+ * Uses the declarations saved in earlier calls to self::enqueue_block_css.
1082+ *
10511083 * @since 6.3.0
10521084 */
10531085 public static function output_block_styles () {
@@ -1065,6 +1097,8 @@ public static function output_block_styles() {
10651097 * Appends the used global style duotone filter presets (CSS custom
10661098 * properties) to the inline global styles CSS.
10671099 *
1100+ * Uses the declarations saved in earlier calls to self::enqueue_global_styles_preset.
1101+ *
10681102 * @since 6.3.0
10691103 */
10701104 public static function output_global_styles () {
@@ -1076,6 +1110,9 @@ public static function output_global_styles() {
10761110 /**
10771111 * Outputs all necessary SVG for duotone filters, CSS for classic themes.
10781112 *
1113+ * Uses the declarations saved in earlier calls to self::enqueue_global_styles_preset
1114+ * and self::enqueue_custom_filter.
1115+ *
10791116 * @since 6.3.0
10801117 */
10811118 public static function output_footer_assets () {
@@ -1129,8 +1166,9 @@ public static function add_editor_settings( $settings ) {
11291166 }
11301167
11311168 /**
1132- * Migrate the old experimental duotone support flag to its stabilized location
1133- * under `supports.filter.duotone` and sets.
1169+ * Migrates the experimental duotone support flag to the stabilized location.
1170+ *
1171+ * This moves `supports.color.__experimentalDuotone` to `supports.filter.duotone`.
11341172 *
11351173 * @since 6.3.0
11361174 *
0 commit comments