CollectionDisplay
in package
implements
ContentDisplayInterface
Collection display for grid-like component arrangements.
The collection display arranges child components in a flexible grid, with control over alignment, distribution, and spacing.
Tags
Table of Contents
Interfaces
- ContentDisplayInterface
- Interface for all ANF content display types.
Constants
- ALIGN_CENTER = 'center'
- ALIGN_LEFT = 'left'
- Valid alignment values.
- ALIGN_RIGHT = 'right'
- DISTRIBUTE_NARROW = 'narrow'
- DISTRIBUTE_WIDE = 'wide'
- Valid distribution values.
Properties
- $alignment : string|null
- Horizontal alignment of components.
- $distribution : string|null
- Distribution of components across columns.
- $gutter : int|null
- Spacing between columns in points.
- $maximumWidth : int|null
- The maximum width of each item in points.
- $minimumWidth : int|null
- The minimum width of each item in points.
- $rowSpacing : int|null
- Spacing between rows in points.
- $variableSizing : bool|null
- Whether to vary column widths for visual interest.
- $widths : int|null
- The width of each item as a column count.
Methods
- centered() : self
- Create a centered collection display.
- getType() : string
- Get the content display type identifier.
- grid() : self
- Create a grid-like collection with specified spacing.
- jsonSerialize() : array<string, mixed>
- {@inheritdoc}
- setAlignment() : $this
- Set the horizontal alignment.
- setDistribution() : $this
- Set the distribution.
- setGutter() : $this
- Set the gutter (column spacing) in points.
- setMaximumWidth() : $this
- Set the maximum item width in points.
- setMinimumWidth() : $this
- Set the minimum item width in points.
- setRowSpacing() : $this
- Set the row spacing in points.
- setVariableSizing() : $this
- Set whether to use variable sizing.
- setWidths() : $this
- Set the item widths as column count.
Constants
ALIGN_CENTER
public
mixed
ALIGN_CENTER
= 'center'
ALIGN_LEFT
Valid alignment values.
public
mixed
ALIGN_LEFT
= 'left'
ALIGN_RIGHT
public
mixed
ALIGN_RIGHT
= 'right'
DISTRIBUTE_NARROW
public
mixed
DISTRIBUTE_NARROW
= 'narrow'
DISTRIBUTE_WIDE
Valid distribution values.
public
mixed
DISTRIBUTE_WIDE
= 'wide'
Properties
$alignment
Horizontal alignment of components.
private
string|null
$alignment
= null
$distribution
Distribution of components across columns.
private
string|null
$distribution
= null
$gutter
Spacing between columns in points.
private
int|null
$gutter
= null
$maximumWidth
The maximum width of each item in points.
private
int|null
$maximumWidth
= null
$minimumWidth
The minimum width of each item in points.
private
int|null
$minimumWidth
= null
$rowSpacing
Spacing between rows in points.
private
int|null
$rowSpacing
= null
$variableSizing
Whether to vary column widths for visual interest.
private
bool|null
$variableSizing
= null
$widths
The width of each item as a column count.
private
int|null
$widths
= null
Methods
centered()
Create a centered collection display.
public
static centered() : self
Return values
self —A new CollectionDisplay instance.
getType()
Get the content display type identifier.
public
getType() : string
Return values
string —The display type (e.g., 'horizontal_stack', 'collection').
grid()
Create a grid-like collection with specified spacing.
public
static grid([int $gutter = 20 ][, int $rowSpacing = 20 ]) : self
Parameters
- $gutter : int = 20
-
Column spacing in points.
- $rowSpacing : int = 20
-
Row spacing in points.
Return values
self —A new CollectionDisplay instance.
jsonSerialize()
{@inheritdoc}
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>setAlignment()
Set the horizontal alignment.
public
setAlignment(string $alignment) : $this
Parameters
- $alignment : string
-
One of 'left', 'center', 'right'.
Return values
$thissetDistribution()
Set the distribution.
public
setDistribution(string $distribution) : $this
Parameters
- $distribution : string
-
One of 'wide', 'narrow'.
Return values
$thissetGutter()
Set the gutter (column spacing) in points.
public
setGutter(int $gutter) : $this
Parameters
- $gutter : int
-
Spacing between columns.
Return values
$thissetMaximumWidth()
Set the maximum item width in points.
public
setMaximumWidth(int $width) : $this
Parameters
- $width : int
-
Maximum width.
Return values
$thissetMinimumWidth()
Set the minimum item width in points.
public
setMinimumWidth(int $width) : $this
Parameters
- $width : int
-
Minimum width.
Return values
$thissetRowSpacing()
Set the row spacing in points.
public
setRowSpacing(int $spacing) : $this
Parameters
- $spacing : int
-
Spacing between rows.
Return values
$thissetVariableSizing()
Set whether to use variable sizing.
public
setVariableSizing(bool $variable) : $this
Parameters
- $variable : bool
-
Whether to vary column widths.
Return values
$thissetWidths()
Set the item widths as column count.
public
setWidths(int $widths) : $this
Parameters
- $widths : int
-
Number of columns each item spans.