phpDocumentor

HubAssetHelper
in package

Class HubAssetHelper

Handles connector assets and resolves correct directory paths based on the current shop version.

This class simplifies the creation of the HubConnector packages by allowing the app to user dynamic paths.

Table of Contents

$versionInfo  : array<string|int, mixed>
$versionName  : string
__construct()  : mixed
HubAssetHelper constructor.
getAssetsBaseUrl()  : string
Get web-assets' base URL for the HubConnector according to the version installed.
getScriptsBaseUrl()  : string
Get script web-assets' base URL for the HubConnector according to the version installed.
getStylesBaseUrl()  : string
Get style web-assets' base URL for the HubConnector according to the version installed.
getTemplatesBasePath()  : string
Get templates base path for the HubConnector according to the version installed.
extractVersionNumbersFromVersionName()  : array<string|int, mixed>
Helper function to extract the version's key (3.x.x[_...]) from a full versionName
isLegacyVersion()  : bool
Helper function whether the current shop version should resolve.
isVersionIdentifier()  : bool
Helper function to verify whether a string is a version identifier.
resolveAssetsBaseUrl()  : string
Resolves the web asset base URL according to the currently installed shop version
resolveScriptsBaseUrl()  : string
Resolves the scripts web asset base URL according to the currently installed shop version.
resolveStylesBaseUrl()  : string
Resolves the styles web asset base URL according to the currently installed shop version.
resolveTemplatesBasePath()  : string
Resolves the templates base path according to the installed shop version

Properties

Methods

__construct()

HubAssetHelper constructor.

public __construct(string $versionName) : mixed
Parameters
$versionName : string

Installed Gambio shop version.

Tags
throws
InvalidArgumentException

If the $version argument is not a string.

Return values
mixed

getAssetsBaseUrl()

Get web-assets' base URL for the HubConnector according to the version installed.

public getAssetsBaseUrl() : string
Return values
string

the base URL for current version's HubConnector general web-assets

getScriptsBaseUrl()

Get script web-assets' base URL for the HubConnector according to the version installed.

public getScriptsBaseUrl() : string
Return values
string

the base URL for current version's HubConnector scripts web-assets

getStylesBaseUrl()

Get style web-assets' base URL for the HubConnector according to the version installed.

public getStylesBaseUrl() : string
Return values
string

the base URL for current version's HubConnector style web-assets

getTemplatesBasePath()

Get templates base path for the HubConnector according to the version installed.

public getTemplatesBasePath() : string
Return values
string

the base path for current version's HubConnector templates

extractVersionNumbersFromVersionName()

Helper function to extract the version's key (3.x.x[_...]) from a full versionName

protected extractVersionNumbersFromVersionName( $versionName) : array<string|int, mixed>
Parameters
$versionName :

string the version name

Return values
array<string|int, mixed>

holding the version numbers

isLegacyVersion()

Helper function whether the current shop version should resolve.

protected isLegacyVersion() : bool
Return values
bool

true, if shop version is below 3.5

isVersionIdentifier()

Helper function to verify whether a string is a version identifier.

protected isVersionIdentifier( $versionName) : bool
Parameters
$versionName :

string

Return values
bool

resolveAssetsBaseUrl()

Resolves the web asset base URL according to the currently installed shop version

protected resolveAssetsBaseUrl() : string
Return values
string

the base URL for web assets

resolveScriptsBaseUrl()

Resolves the scripts web asset base URL according to the currently installed shop version.

protected resolveScriptsBaseUrl() : string
Return values
string

the base URL for script web assets

resolveStylesBaseUrl()

Resolves the styles web asset base URL according to the currently installed shop version.

protected resolveStylesBaseUrl() : string
Return values
string

the base URL for style web assets

resolveTemplatesBasePath()

Resolves the templates base path according to the installed shop version

protected resolveTemplatesBasePath() : string
Return values
string

the base path for template assets

Search results