WP_Style_Engine_CSS_Declarations::get_declarations_string
Filters and compiles the CSS declarations.
Метод класса: WP_Style_Engine_CSS_Declarations{}
Хуков нет.
Возвращает
Строку. The CSS declarations.
Использование
$WP_Style_Engine_CSS_Declarations = new WP_Style_Engine_CSS_Declarations(); $WP_Style_Engine_CSS_Declarations->get_declarations_string( $should_prettify, $indent_count );
- $should_prettify(true|false)
- Whether to add spacing, new lines and indents.
По умолчанию: false - $indent_count(int)
- The number of tab indents to apply to the rule. Applies if prettify is true.
Список изменений
| С версии 6.1.0 | Введена. |
Код WP_Style_Engine_CSS_Declarations::get_declarations_string() WP Style Engine CSS Declarations::get declarations string WP 6.8.3
public function get_declarations_string( $should_prettify = false, $indent_count = 0 ) {
$declarations_array = $this->get_declarations();
$declarations_output = '';
$indent = $should_prettify ? str_repeat( "\t", $indent_count ) : '';
$suffix = $should_prettify ? ' ' : '';
$suffix = $should_prettify && $indent_count > 0 ? "\n" : $suffix;
$spacer = $should_prettify ? ' ' : '';
foreach ( $declarations_array as $property => $value ) {
$filtered_declaration = static::filter_declaration( $property, $value, $spacer );
if ( $filtered_declaration ) {
$declarations_output .= "{$indent}{$filtered_declaration};$suffix";
}
}
return rtrim( $declarations_output );
}