class ElevateZoomPlus in ElevateZoom Plus 7
Same name and namespace in other branches
- 8 src/Entity/ElevateZoomPlus.php \Drupal\elevatezoomplus\Entity\ElevateZoomPlus
Defines the ElevateZoomPlus configuration entity.
Hierarchy
- class \Drupal\slick\Entity\SlickBase implements SlickBaseInterface
- class \Drupal\elevatezoomplus\Entity\ElevateZoomPlus implements ElevateZoomPlusInterface
Expanded class hierarchy of ElevateZoomPlus
4 files declare their use of ElevateZoomPlus
- elevatezoomplus.elevatezoomplus_optionset.inc in ./
elevatezoomplus.elevatezoomplus_optionset.inc - ElevateZoomPlus default optionset API include file.
- elevatezoomplus.install in ./
elevatezoomplus.install - Installation actions for ElevateZoomPlus.
- ElevateZoomPlusForm.php in modules/
ui/ src/ Form/ ElevateZoomPlusForm.php - ElevateZoomPlusManager.php in src/
ElevateZoomPlusManager.php
File
- src/
Entity/ ElevateZoomPlus.php, line 10
Namespace
Drupal\elevatezoomplus\EntityView source
class ElevateZoomPlus extends SlickBase implements ElevateZoomPlusInterface {
/**
* Defines elevatezoomplus table name.
*/
const TABLE = 'elevatezoomplus_optionset';
/**
* {@inheritdoc}
*/
public static function create(array $values = []) {
ctools_include('export');
$optionset = ctools_export_crud_new(static::TABLE);
$optionset->options = $optionset->options['settings'] = [];
foreach (self::defaultProperties() as $key => $ignore) {
if (isset($values[$key])) {
$optionset->{$key} = $values[$key];
}
}
if (empty($values['label']) && isset($values['name'])) {
$optionset->label = $values['name'];
}
$defaults['settings'] = self::defaultSettings();
$optionset->options = $optionset->options + $defaults;
return $optionset;
}
/**
* Returns the typecast values.
*
* @param array $settings
* An array of Optionset settings.
*/
public static function typecast(array &$settings = []) {
if (empty($settings)) {
return;
}
$defaults = self::defaultSettings();
foreach ($defaults as $name => $value) {
if (isset($settings[$name])) {
// Seems double is ignored, and causes a missing schema, unlike float.
$type = gettype($defaults[$name]);
$type = $type == 'double' ? 'float' : $type;
// Change float to integer if value is no longer float.
if ($name == 'lensOpacity' || $name == 'tintOpacity') {
$type = $settings[$name] == '0' || $settings[$name] == '1' ? 'integer' : 'float';
}
settype($settings[$name], $type);
}
}
}
/**
* {@inheritdoc}
*/
public static function defaultSettings() {
if (!isset(static::$defaultSettings)) {
static::$defaultSettings = [
'responsive' => FALSE,
'zoomType' => 'window',
'zoomWindowWidth' => 400,
'zoomWindowHeight' => 400,
'zoomWindowOffsetX' => 0,
'zoomWindowOffsetY' => 0,
'zoomWindowPosition' => '1',
'zoomWindowFadeIn' => FALSE,
'zoomWindowFadeOut' => FALSE,
'zoomTintFadeIn' => FALSE,
'zoomTintFadeOut' => FALSE,
'scrollZoom' => FALSE,
'easing' => FALSE,
'easingType' => 'zoomdefault',
'easingDuration' => 2000,
'borderSize' => 4,
'borderColour' => '#888',
'showLens' => TRUE,
'containLensZoom' => FALSE,
'lensBorder' => 1,
'lensShape' => 'square',
'lensSize' => 200,
'lensFadeIn' => FALSE,
'lensFadeOut' => FALSE,
'lensColour' => 'white',
'lensOpacity' => 0.4,
'lenszoom' => FALSE,
'tint' => FALSE,
'tintColour' => '#333',
'tintOpacity' => 0.4,
'constrainType' => '',
'constrainSize' => '',
'imageCrossfade' => FALSE,
'cursor' => 'default',
'loadingIcon' => '',
];
}
return static::$defaultSettings;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ElevateZoomPlus:: |
public static | function |
Returns a new optionset object without saving it to the database. Overrides SlickBase:: |
|
ElevateZoomPlus:: |
public static | function |
Returns available slick default options under group 'settings'. Overrides SlickBase:: |
|
ElevateZoomPlus:: |
constant |
Defines elevatezoomplus table name. Overrides SlickBase:: |
||
ElevateZoomPlus:: |
public static | function |
Returns the typecast values. Overrides SlickBase:: |
|
SlickBase:: |
protected static | property | The plugin default settings. | 1 |
SlickBase:: |
public | property | The human-readable name for the optionset. | |
SlickBase:: |
public | property | The legacy CTools ID for the configurable optionset. | |
SlickBase:: |
public | property | The plugin instance options. | |
SlickBase:: |
public static | function | Returns default database field property values. | 1 |
SlickBase:: |
public | function | Deletes the optionset from database. | |
SlickBase:: |
public static | function |
Checks whether an optionset with the given name already exists. Overrides SlickBaseInterface:: |
|
SlickBase:: |
public | function |
Returns the Slick options by group, or property. Overrides SlickBaseInterface:: |
|
SlickBase:: |
public | function |
Returns the value of a slick setting. Overrides SlickBaseInterface:: |
|
SlickBase:: |
public | function |
Returns the array of slick settings. Overrides SlickBaseInterface:: |
|
SlickBase:: |
public | function | Overrides Drupal\Core\Entity\Entity::id(). | |
SlickBase:: |
public | function | The slick label. | |
SlickBase:: |
public static | function |
Returns the given optionset object identified by $id. Overrides SlickBaseInterface:: |
|
SlickBase:: |
public static | function |
Fetches all optionsets from the storage. Overrides SlickBaseInterface:: |
|
SlickBase:: |
public static | function | Load the optionset with a fallback. | |
SlickBase:: |
public | function | Saves the optionset to database. | |
SlickBase:: |
public | function |
Sets the value of a slick setting. Overrides SlickBaseInterface:: |
|
SlickBase:: |
public | function |
Sets the array of slick settings. Overrides SlickBaseInterface:: |
|
SlickBase:: |
public | function | Returns an array of all property values. |