Apple News API PHP Client

ConditionalText extends ConditionalComponent
in package

FinalYes

Conditional properties for text components.

Allows text-specific properties like textStyle to change based on conditions.

Tags
see
https://developer.apple.com/documentation/apple_news/conditionaltext

Table of Contents

Properties

$anchor  : string|null
The anchor configuration.
$conditions  : array<int, Condition>
The conditions that must be met.
$hidden  : bool|null
Whether the component is hidden.
$layout  : string|null
The layout reference.
$style  : string|null
The style reference.
$inlineTextStyles  : array<string, mixed>|null
Inline text styles.
$textStyle  : string|null
The text style reference.

Methods

addCondition()  : $this
Add a condition.
hasConditions()  : bool
Check if any conditions have been set.
hiddenOnCompact()  : self
Create a conditional that hides on compact width.
jsonSerialize()  : array<string, mixed>
{@inheritdoc}
setAnchor()  : $this
Set the anchor.
setConditions()  : $this
Set multiple conditions.
setHidden()  : $this
Set whether the component is hidden.
setInlineTextStyles()  : $this
Set inline text styles.
setLayout()  : $this
Set the layout reference.
setStyle()  : $this
Set the style reference.
setTextStyle()  : $this
Set the text style reference.
visibleOnRegular()  : self
Create a conditional that shows only on regular width.

Properties

$inlineTextStyles

Inline text styles.

private array<string, mixed>|null $inlineTextStyles = null

$textStyle

The text style reference.

private string|null $textStyle = null

Methods

hasConditions()

Check if any conditions have been set.

public hasConditions() : bool
Return values
bool

True if conditions exist.

hiddenOnCompact()

Create a conditional that hides on compact width.

public static hiddenOnCompact() : self
Return values
self

A new instance.

jsonSerialize()

{@inheritdoc}

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

setAnchor()

Set the anchor.

public setAnchor(string $anchor) : $this
Parameters
$anchor : string

The anchor reference.

Return values
$this

setConditions()

Set multiple conditions.

public setConditions(array<int, Condition$conditions) : $this
Parameters
$conditions : array<int, Condition>

The conditions.

Return values
$this

setHidden()

Set whether the component is hidden.

public setHidden(bool $hidden) : $this
Parameters
$hidden : bool

Whether hidden.

Return values
$this

setInlineTextStyles()

Set inline text styles.

public setInlineTextStyles(array<string, mixed> $styles) : $this
Parameters
$styles : array<string, mixed>

The inline styles.

Return values
$this

setLayout()

Set the layout reference.

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

The layout name.

Return values
$this

setStyle()

Set the style reference.

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

The style name.

Return values
$this

setTextStyle()

Set the text style reference.

public setTextStyle(string $textStyle) : $this
Parameters
$textStyle : string

The text style name.

Return values
$this

visibleOnRegular()

Create a conditional that shows only on regular width.

public static visibleOnRegular() : self
Return values
self

A new instance.


        
On this page

Search results