method_get_block_inline_styles()
method_get_block_inline_styles( $block_attributes, $set_margins = true )
Generates an inline style="" attribute from WordPress’s built‑in block style attributes.
Description
Uses wp_style_engine_get_styles() to convert the block’s style attribute into an inline CSS string. Also resolves color slugs to hex values and handles gap and layout orientation properties that wp_style_engine doesn’t cover natively.
Parameters
$block_attributes (array) :
The full block attributes array.
$set_margins (bool) :
When true, defaults top and bottom margins to '0' if not set. Default true.
Return
(string) Complete inline style attribute: ' style="..."'.
Source
File: lib/blocks.php
Notes
- This is a legacy function used for blocks that rely on WordPress’s native style system rather than Method’s
responsiveSettingssystem.
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |