Map
extends Component
in package
Map component for displaying Apple Maps.
The map component displays an interactive map with optional annotations.
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
- The accessibility caption for VoiceOver users.
- $caption : string|null
- The caption for the map.
- $items : array<int, array<string, mixed>>|null
- Map annotation items.
- $latitude : float
- $longitude : float
- $mapType : string|null
- The map type.
- $span : array{latitudeDelta?: float, longitudeDelta?: float}|null
- Map span configuration.
Methods
- __construct() : mixed
- Create a new Map component.
- addMarker() : $this
- Add a marker annotation to the map.
- atCoordinates() : self
- Create a Map centered at specific coordinates.
- getRole() : string
- Get the role name for the component (e.g., 'body', 'photo', 'heading1').
- jsonSerialize() : array<string, mixed>
- Implementation of JsonSerializable.
- setAccessibilityCaption() : $this
- Set the accessibility caption for VoiceOver.
- setAnchor() : static
- Set the anchor configuration.
- setAnimation() : static
- Set component animation using an array.
- setAnimationObject() : static
- Set the component animation using a typed Animation object.
- setBehavior() : static
- Set the component behavior using an array.
- setBehaviorObject() : static
- Set the component behavior using a typed Behavior object.
- setCaption() : $this
- Set the map caption.
- setConditional() : static
- Set conditional properties for the component.
- 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.
- setMapType() : $this
- Set the map type.
- setSpan() : $this
- Set the map span (zoom level).
- 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
The accessibility caption for VoiceOver users.
private
string|null
$accessibilityCaption
= null
$caption
The caption for the map.
private
string|null
$caption
= null
$items
Map annotation items.
private
array<int, array<string, mixed>>|null
$items
= null
$latitude read-only
private
float
$latitude
$longitude read-only
private
float
$longitude
$mapType
The map type.
private
string|null
$mapType
= null
$span
Map span configuration.
private
array{latitudeDelta?: float, longitudeDelta?: float}|null
$span
= null
Methods
__construct()
Create a new Map component.
public
__construct(float $latitude, float $longitude) : mixed
Parameters
- $latitude : float
-
The center latitude.
- $longitude : float
-
The center longitude.
addMarker()
Add a marker annotation to the map.
public
addMarker(float $latitude, float $longitude[, string|null $caption = null ]) : $this
Parameters
- $latitude : float
-
The marker latitude.
- $longitude : float
-
The marker longitude.
- $caption : string|null = null
-
Optional marker caption.
Return values
$thisatCoordinates()
Create a Map centered at specific coordinates.
public
static atCoordinates(float $latitude, float $longitude) : self
Parameters
- $latitude : float
-
The center latitude.
- $longitude : float
-
The center longitude.
Return values
self —A new Map instance.
getRole()
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 the accessibility caption for VoiceOver.
public
setAccessibilityCaption(string $caption) : $this
Parameters
- $caption : string
-
The accessibility caption.
Return values
$thissetAnchor()
Set the anchor configuration.
public
setAnchor(string $anchor) : static
Parameters
- $anchor : string
-
The anchor configuration.
Return values
staticsetAnimation()
Set component animation using an array.
public
setAnimation(array<string, mixed> $animation) : static
Parameters
- $animation : array<string, mixed>
-
Animation properties.
Tags
Return values
staticsetAnimationObject()
Set the component animation using a typed Animation object.
public
setAnimationObject(AnimationInterface $animation) : static
This method provides type-safe animation configuration:
$photo->setAnimationObject(FadeInAnimation::fromTransparent());
$body->setAnimationObject(MoveInAnimation::fromLeft());
Parameters
- $animation : AnimationInterface
-
The animation object.
Return values
staticsetBehavior()
Set the component behavior using an array.
public
setBehavior(array<string, mixed> $behavior) : static
Parameters
- $behavior : array<string, mixed>
-
The behavior configuration array.
Tags
Return values
staticsetBehaviorObject()
Set the component behavior using a typed Behavior object.
public
setBehaviorObject(BehaviorInterface $behavior) : static
This method provides type-safe behavior configuration:
$photo->setBehaviorObject(Parallax::withFactor(0.8));
$photo->setBehaviorObject(new Springy());
Parameters
- $behavior : BehaviorInterface
-
The behavior object.
Return values
staticsetCaption()
Set the map caption.
public
setCaption(string $caption) : $this
Parameters
- $caption : string
-
The caption text.
Return values
$thissetConditional()
Set conditional properties for the component.
public
setConditional(array<string, mixed> $conditional) : static
Parameters
- $conditional : array<string, mixed>
-
Array of conditions.
Tags
Return values
staticsetHidden()
Set whether the component is hidden.
public
setHidden(bool $hidden) : static
Parameters
- $hidden : bool
-
Whether to hide the component.
Return values
staticsetIdentifier()
Set a unique identifier for this component.
public
setIdentifier(string $identifier) : static
Parameters
- $identifier : string
-
The unique identifier.
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
staticsetMapType()
Set the map type.
public
setMapType(string $mapType) : $this
Parameters
- $mapType : string
-
The map type ('standard', 'hybrid', 'satellite').
Return values
$thissetSpan()
Set the map span (zoom level).
public
setSpan(float $latitudeDelta, float $longitudeDelta) : $this
Parameters
- $latitudeDelta : float
-
The latitude span in degrees.
- $longitudeDelta : float
-
The longitude span in degrees.
Return values
$thissetStyle()
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>