Photo
extends Component
in package
Component for displaying single images in an article.
Supports remote URLs and local bundle resources.
Tags
Table of Contents
Properties
- $anchor : string|null
- $animation : array<string, mixed>|null
- $behavior : array<string, mixed>|null
- $conditional : array<string, mixed>|null
- $hidden : bool
- $identifier : string|null
- $layout : string|null
- $style : string|null
- $accessibilityCaption : string|null
- $caption : string|null
- $explicitContent : bool|null
- $url : string
Methods
- __construct() : mixed
- fromBundle() : self
- Create a photo referencing a file in the multipart bundle.
- fromUrl() : self
- Create a photo referencing an external image URL.
- getRole() : string
- Get the role name for the component (e.g., 'body', 'photo', 'heading1').
- jsonSerialize() : array<string, mixed>
- Implementation of JsonSerializable.
- setAccessibilityCaption() : self
- Set a VoiceOver accessibility description.
- setAnchor() : static
- Set the anchor configuration.
- setAnimation() : static
- Set component animation.
- setBehavior() : static
- Set component behavior.
- setCaption() : self
- Set a visible caption.
- setConditional() : static
- Set conditional properties for the component.
- setExplicitContent() : self
- Mark the image as explicit content.
- 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.
$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.
$accessibilityCaption
private
string|null
$accessibilityCaption
= null
$caption
private
string|null
$caption
= null
$explicitContent
private
bool|null
$explicitContent
= null
$url read-only
private
string
$url
Methods
__construct()
public
__construct(string $url) : mixed
Parameters
- $url : string
-
The image URL (bundle://... or http...).
fromBundle()
Create a photo referencing a file in the multipart bundle.
public
static fromBundle(string $filename) : self
Parameters
- $filename : string
Return values
selffromUrl()
Create a photo referencing an external image URL.
public
static fromUrl(string $url) : self
Parameters
- $url : string
Return values
selfgetRole()
Get the role name for the component (e.g., 'body', 'photo', 'heading1').
public
getRole() : string
Return values
stringjsonSerialize()
Implementation of JsonSerializable.
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>setAccessibilityCaption()
Set a VoiceOver accessibility description.
public
setAccessibilityCaption(string $caption) : self
Parameters
- $caption : string
Return values
selfsetAnchor()
Set the anchor configuration.
public
setAnchor(string $anchor) : static
Parameters
- $anchor : string
Return values
staticsetAnimation()
Set component animation.
public
setAnimation(array<string, mixed> $animation) : static
Parameters
- $animation : array<string, mixed>
-
Animation properties.
Tags
Return values
staticsetBehavior()
Set component behavior.
public
setBehavior(array<string, mixed> $behavior) : static
Parameters
- $behavior : array<string, mixed>
-
Behavior properties (e.g., parallax).
Tags
Return values
staticsetCaption()
Set a visible caption.
public
setCaption(string $caption) : self
Parameters
- $caption : string
Return values
selfsetConditional()
Set conditional properties for the component.
public
setConditional(array<string, mixed> $conditional) : static
Parameters
- $conditional : array<string, mixed>
-
Array of conditions.
Tags
Return values
staticsetExplicitContent()
Mark the image as explicit content.
public
setExplicitContent(bool $explicit) : self
Parameters
- $explicit : bool
Return values
selfsetHidden()
Set whether the component is hidden.
public
setHidden(bool $hidden) : static
Parameters
- $hidden : bool
Return values
staticsetIdentifier()
Set a unique identifier for this component.
public
setIdentifier(string $identifier) : static
Parameters
- $identifier : string
Return values
staticsetLayout()
Set the layout name or inline layout.
public
setLayout(string $layout) : static
Parameters
- $layout : string
-
Reference to a name in componentLayouts.
Return values
staticsetStyle()
Set the style name.
public
setStyle(string $style) : static
Parameters
- $style : string
-
Reference to a name in componentStyles.
Return values
staticgetBaseProperties()
Get the base properties common to all components for JSON serialization.
protected
getBaseProperties() : array<string, mixed>