Layout final class
Minn\Blocks\Layout · public/minn/src/Minn/Blocks/Layout.php · 167 lines
The layout support's classes and rules (wp_render_layout_support_flag, probe block-supports), for core and plugin blocks alike:
- is-layout-{type} and {block}-is-layout-{type} for the layout the block uses (its own over its type's default), with has-global-padding for a constrained layout under a theme with root-padding-aware alignments; - is-vertical or is-horizontal, is-content-justification-* and is-nowrap from the layout the block itself stores; - a wp-container-{block}-is-layout-* class when the layout writes CSS (LayoutStyle), and wp-container-content-* for a child's own size or place in its parent's layout.
The rules go to the page's block-support styles through the private minn_block_support_rules action. A container class's suffix is a digest the engine cannot reproduce (its inputs are not observable), so the engine derives its own from the layout: same shape, different value, which the parity suites normalise.
Public
| static | classes(string $blockName, array $attrs): array# | The layout classes a core block's wrapper carries, under its type's supports (data/blocks.json). @return list<string> | ||||||
| static | forBlock(string $blockName, array $attrs, array $supports): array# | The layout classes a block's wrapper carries, its container's rules recorded, under the theme's layout settings the render state holds (root-padding-aware alignments, block gaps).
@return list<string> | ||||||
| static | childClass(array $child, array $parent): ?string# | The class a child's own layout earns (its size or place in the parent's layout), its rules recorded; null when it writes none.
| ||||||
| static | sanitizeGap(mixed $gap): mixed# | A block gap as the layout reads it: a value with a character that could end a declaration or open a function (\ ( & = } or a comment) is dropped, a side of one too; anything not a string is left as it is. | ||||||
| static | gapCss(mixed $gap): array|string|null# | A gap with its presets as custom properties, a side at a time. @return string|array<string, string>|null | ||||||
| static | paddingCss(array $padding): array# | A block's side padding with its presets as custom properties. @return array<string, string> | ||||||
| static | widths(array $layout): array# | A layout with its widths checked: the first declaration of each, through the style attribute filter, empty when that drops it. @return array<string, mixed> |
Internals 5
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | safeGap(string $value): ?string# | ||||
| private | skipsGap(array $supports): bool# |
| |||
| private | used(array $own, array $supports): array# | The layout a block uses: its own over its type's default; the legacy inherit flag means constrained.
@return array<string, mixed> | |||
| private | typeClasses(string $type, array $own): array# | @return list<string> | |||
| private | record(array $rules): void# |
|
Nothing matches.