Documentation

Banner
in package

Table of Contents

Properties

$assets  : array<string|int, Assets>
$attributes  : array<string|int, Attribute>
$blogId  : int|null
$id  : string

Methods

__construct()  : mixed
Banner constructor.
getAllAssets()  : array<string|int, mixed>
Retrieves all assets associated with the object.
getAssets()  : array<string|int, mixed>|null
Retrieves a specific assets by it name.
getAttribute()  : Attribute|null
Get a Banner attribute object by name.
getAttributeValue()  : array<string|int, mixed>|string|false
Get the value of a Banner attribute by name.
getId()  : string
Get the Banner ID.
getOrder()  : int
Get the order of the banner.
getPackshotsPrime()  : array<string|int, mixed>
Resolve the banner's prime packshot, preferring the localized variant when present.
getType()  : string
Get the type of the banner.
filterAssetGroupByLocale()  : array<string|int, Asset>
Filters asset variants to the current blog locale.
getLocalizedAssets()  : array<string|int, mixed>
Return a locale-filtered asset group by name.

Properties

$assets

private array<string|int, Assets> $assets

Array of Asset objects

$attributes

private array<string|int, Attribute> $attributes

Array of Attribute objects

$blogId

private int|null $blogId

Blog context used to resolve the site locale for localized assets.

Methods

__construct()

Banner constructor.

public __construct(string $id[, int|null $blogId = null ]) : mixed

Initializes a Banner object by loading Banner data from the ProductsCollection.

Parameters
$id : string

The unique identifier for the banner.

$blogId : int|null = null
Tags
throws
Exception

If the Banner is not found in the collection.

getAllAssets()

Retrieves all assets associated with the object.

public getAllAssets() : array<string|int, mixed>

This method returns an array of all assets. Each asset is stored as an associative array within the $this->assets instance variable.

Return values
array<string|int, mixed>

An associative array of all assets, where the key is the asset name and the value is the asset's details.

getAssets()

Retrieves a specific assets by it name.

public getAssets(string $name[, bool $asArrays = false ]) : array<string|int, mixed>|null

This method searches for an asset in the $this->assets array by the provided asset name. If an asset with the given name exists, it returns the asset's details; otherwise, it returns null.

Parameters
$name : string

The name of the asset to retrieve.

$asArrays : bool = false
Return values
array<string|int, mixed>|null

The details of the asset if found; otherwise, null.

getAttribute()

Get a Banner attribute object by name.

public getAttribute(string $name) : Attribute|null
Parameters
$name : string

The name of the attribute.

Return values
Attribute|null

The Attribute object if found, or null if not found.

getAttributeValue()

Get the value of a Banner attribute by name.

public getAttributeValue(string $name) : array<string|int, mixed>|string|false
Parameters
$name : string

The name of the attribute.

Return values
array<string|int, mixed>|string|false

The value of the attribute if found, or false if not found or empty.

getId()

Get the Banner ID.

public getId() : string
Return values
string

The unique identifier of the Banner.

getOrder()

Get the order of the banner.

public getOrder() : int
Return values
int

The order of the banner.

getPackshotsPrime()

Resolve the banner's prime packshot, preferring the localized variant when present.

public getPackshotsPrime([bool $asArrays = false ]) : array<string|int, mixed>

If the localized "Packshots Prime Content Loc" group has an asset matching the current site locale, that is returned; otherwise it falls back to the default (non-localized) packshots_prime — i.e. the previous behavior. Mirrors the product hero gallery's Product::getPackshotsPrimeRetail() pattern.

Parameters
$asArrays : bool = false

Whether to return the assets as arrays.

Return values
array<string|int, mixed>

The resolved packshot assets (Asset objects, or arrays when $asArrays).

getType()

Get the type of the banner.

public getType() : string
Return values
string

The type of the banner.

filterAssetGroupByLocale()

Filters asset variants to the current blog locale.

private filterAssetGroupByLocale(array<string|int, Asset$assets) : array<string|int, Asset>

Copy of Product::filterAssetGroupByLocale() — keeps Banner self-contained rather than introducing a cross-class dependency, following the existing house style.

Parameters
$assets : array<string|int, Asset>

The asset group to filter.

Return values
array<string|int, Asset>

Assets matching the current locale (or all, if no locale is configured).

getLocalizedAssets()

Return a locale-filtered asset group by name.

private getLocalizedAssets(string $name[, bool $asArrays = false ]) : array<string|int, mixed>

Unlike Product::getAssets(), Banner::getAssets() intentionally stays unfiltered for back-compat with existing banner consumers, so localized lookups need their own filter.

Parameters
$name : string

The asset group name.

$asArrays : bool = false

Whether to return the assets as arrays.

Return values
array<string|int, mixed>

The filtered assets.

On this page

Search results