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.
Mostra file
Open project: heyday/silverstripe-responsive-images
Protected Properties
Property |
Type |
Description |
|
$configSets |
|
A cached copy of the image sets |
|
Public Methods
Method |
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. |
|
Protected Methods
Method |
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 |
return |
HTMLText |
|
__construct()
public method
allMethodNames()
public method
Defines all the methods that can be called in this class.
createResponsiveSet()
protected method
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 |
return |
SSViewer |
|
getConfigForSet()
protected method
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 method
Returns a list of available image sets.
Property Details
$configSets protected_oe property
A cached copy of the image sets