PHP Class Heyday\ResponsiveImages\ResponsiveImageExtension

Image sets are defined in the config layer, e.g: Heyday\ResponsiveImages\ResponsiveImageExtension: sets: MyResponsiveImageSet: method: CroppedImage arguments: "(min-width: 200px)": [200, 100] "(min-width: 800px)": [200, 400] "(min-width: 1200px) and (min-device-pixel-ratio: 2.0)": [800, 400] default_arguments: [200, 400] This provides $MyImage.MyResponsiveImageSet to the template. For more documentation on implementation, see the README file.
Inheritance: extends Extension
Afficher le fichier Open project: heyday/silverstripe-responsive-images

Protected Properties

Свойство Type Description
$configSets A cached copy of the image sets

Méthodes publiques

Méthode Description
__call ( string $method, array $args ) : HTMLText A wildcard method for handling responsive sets as template functions, e.g. $MyImage.ResponsiveSet1
__construct ( )
allMethodNames ( ) : array Defines all the methods that can be called in this class.

Méthodes protégées

Méthode Description
createResponsiveSet ( array $config, array $defaultArgs, string $set ) : SSViewer Requires the necessary JS and sends the required HTML structure to the template for a responsive image set.
getConfigForSet ( string $setName ) : array | false Due to {@link Object::allMethodNames()} requiring methods to be expressed in all lowercase, getting the config for a given method requires a case-insensitive comparison.
getResponsiveSets ( ) : array Returns a list of available image sets.

Method Details

__call() public méthode

A wildcard method for handling responsive sets as template functions, e.g. $MyImage.ResponsiveSet1
public __call ( string $method, array $args ) : HTMLText
$method string The method called
$args array The arguments passed to the method
Résultat HTMLText

__construct() public méthode

public __construct ( )

allMethodNames() public méthode

Defines all the methods that can be called in this class.
public allMethodNames ( ) : array
Résultat array

createResponsiveSet() protected méthode

Requires the necessary JS and sends the required HTML structure to the template for a responsive image set.
protected createResponsiveSet ( array $config, array $defaultArgs, string $set ) : SSViewer
$config array The configuration of the responsive image set
$defaultArgs array The arguments passed to the responsive image method call, e.g. $MyImage.ResponsiveSet(800x600)
$set string The method, or responsive image set, to generate
Résultat SSViewer

getConfigForSet() protected méthode

Due to {@link Object::allMethodNames()} requiring methods to be expressed in all lowercase, getting the config for a given method requires a case-insensitive comparison.
protected getConfigForSet ( string $setName ) : array | false
$setName string The name of the responsive image set to get
Résultat array | false

getResponsiveSets() protected méthode

Returns a list of available image sets.
protected getResponsiveSets ( ) : array
Résultat array

Property Details

$configSets protected_oe property

A cached copy of the image sets
protected $configSets