Elements final class
Minn\Blocks\Elements · public/minn/src/Minn/Blocks/Elements.php · 121 lines
Per-block element styles (style.elements in a block's attributes, the link colour most often; probe block-supports). A block whose element styles set a colour gets a numbered wp-elements-N class and a rule per element and state, recorded with the page's block-support styles in render order: links (their text colour, plain or on hover), headings, each heading level and buttons (text, background or gradient). A block type whose colour support skips serialization, whole or for links, headings or buttons, writes none for those.
Constants and properties
| private | SELECTORS = array ( 'link' => 'a:where(:not(.wp-element-button))', 'heading' => 'h1, h2, h3, h4, h5, h6', 'h1' => 'h1', 'h2' => 'h2', 'h3' => 'h3', 'h4' => 'h4', 'h5' => 'h5', 'h6' => 'h6', 'button' => '.wp-element-button, .wp-block-button__link', ) | |
| private | KINDS = array ( 'link' => 'link', 'heading' => 'heading', 'h1' => 'heading', 'h2' => 'heading', 'h3' => 'heading', 'h4' => 'heading', 'h5' => 'heading', 'h6' => 'heading', 'button' => 'button', ) | The kind each element's skip answers to: every heading level is a heading. |
Public
| static | className(array $attrs, array $supports): ?string# | The block's wp-elements-N class, recording its rules; null when its element styles earn none.
| ||||||
| static | shouldAdd(array $elements, array $skip): bool# | Whether element styles earn a class: a link's text colour (or its hover's), a heading's, a heading level's or a button's text, background or gradient, for a kind not skipped.
| ||||||
| static | skips(array $supports): array# | The kinds a block type's colour support skips serializing.
@return array<string, bool> |
Internals 2
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
Nothing matches.