WP_Theme_JSON::compute_preset_classes( array $settings, string $selector, string[] $origins ): string

In this article

Given a settings array, returns the generated rulesets for the preset classes.

Parameters

$settingsarrayrequired
Settings to process.
$selectorstringrequired
Selector wrapping the classes.
$originsstring[]required
List of origins to process.

Return

string The result of processing the presets.

Source

						$block_rules    .= static::to_ruleset( $layout_selector, $declarations );
					}
				}
			}
		}
	}
	return $block_rules;
}

/**
 * Creates new rulesets as classes for each preset value such as:
 *
 *   .has-value-color {
 *     color: value;
 *   }
 *
 *   .has-value-background-color {
 *     background-color: value;
 *   }
 *
 *   .has-value-font-size {
 *     font-size: value;
 *   }
 *
 *   .has-value-gradient-background {
 *     background: value;
 *   }
 *
 *   p.has-value-gradient-background {
 *     background: value;
 *   }
 *
 * @since 5.9.0
 *

Changelog

VersionDescription
5.9.0Added the $origins parameter.
5.8.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.