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.
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
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
allMethodNames()
public méthode
Defines all the methods that can be called in this class.
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.
getResponsiveSets()
protected méthode
Returns a list of available image sets.
Property Details
$configSets protected_oe property
A cached copy of the image sets