Apple News API PHP Client

Container extends Component
in package

A container component used to group other components together.

Containers are useful for applying shared layouts, backgrounds, or behaviors to a set of child components.

Tags
see
https://developer.apple.com/documentation/applenewsformat/container

Table of Contents

Properties

$anchor  : string|null
$animation  : array<string, mixed>|null
$behavior  : array<string, mixed>|null
$components  : array<string|int, Component>
$conditional  : array<string, mixed>|null
$contentDisplay  : string|null
$hidden  : bool
$identifier  : string|null
$layout  : string|null
$style  : string|null

Methods

addComponent()  : self
Add a child component to this container.
getRole()  : string
Get the role name for the component (e.g., 'body', 'photo', 'heading1').
jsonSerialize()  : array<string, mixed>
Implementation of JsonSerializable.
setAnchor()  : static
Set the anchor configuration.
setAnimation()  : static
Set component animation.
setBehavior()  : static
Set component behavior.
setConditional()  : static
Set conditional properties for the component.
setContentDisplay()  : self
Set the content display mode (e.g., for horizontal scrolling).
setHidden()  : static
Set whether the component is hidden.
setIdentifier()  : static
Set a unique identifier for this component.
setLayout()  : static
Set the layout name or inline layout.
setStyle()  : static
Set the style name.
getBaseProperties()  : array<string, mixed>
Get the base properties common to all components for JSON serialization.

Properties

$anchor

protected string|null $anchor = null

Anchor configuration for pinning components.

$animation

protected array<string, mixed>|null $animation = null

Animation settings for the component.

$behavior

protected array<string, mixed>|null $behavior = null

Behavior settings (e.g., Parallax).

$conditional

protected array<string, mixed>|null $conditional = null

Conditional properties based on orientation/device.

$contentDisplay

protected string|null $contentDisplay = null

Layout mode for child components.

$hidden

protected bool $hidden = false

Whether the component is hidden by default.

$identifier

protected string|null $identifier = null

A unique identifier for this component instance.

$layout

protected string|null $layout = null

Reference to a named layout defined in Article.

$style

protected string|null $style = null

Reference to a named style defined in Article.

Methods

addComponent()

Add a child component to this container.

public addComponent(Component $component) : self
Parameters
$component : Component
Return values
self

getRole()

Get the role name for the component (e.g., 'body', 'photo', 'heading1').

public getRole() : string
Return values
string

jsonSerialize()

Implementation of JsonSerializable.

public jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>

setAnchor()

Set the anchor configuration.

public setAnchor(string $anchor) : static
Parameters
$anchor : string
Return values
static

setContentDisplay()

Set the content display mode (e.g., for horizontal scrolling).

public setContentDisplay(string $contentDisplay) : self
Parameters
$contentDisplay : string
Return values
self

setHidden()

Set whether the component is hidden.

public setHidden(bool $hidden) : static
Parameters
$hidden : bool
Return values
static

setIdentifier()

Set a unique identifier for this component.

public setIdentifier(string $identifier) : static
Parameters
$identifier : string
Return values
static

setLayout()

Set the layout name or inline layout.

public setLayout(string $layout) : static
Parameters
$layout : string

Reference to a name in componentLayouts.

Return values
static

setStyle()

Set the style name.

public setStyle(string $style) : static
Parameters
$style : string

Reference to a name in componentStyles.

Return values
static

getBaseProperties()

Get the base properties common to all components for JSON serialization.

protected getBaseProperties() : array<string, mixed>
Return values
array<string, mixed>

        
On this page

Search results