public function ElevateZoomPlusForm::getFormElements in ElevateZoom Plus 7
Same name and namespace in other branches
- 8 modules/ui/src/Form/ElevateZoomPlusForm.php \Drupal\elevatezoomplus_ui\Form\ElevateZoomPlusForm::getFormElements()
Defines available options.
Return value
array All available options.
1 call to ElevateZoomPlusForm::getFormElements()
- ElevateZoomPlusForm::attachSettingsForm in modules/
ui/ src/ Form/ ElevateZoomPlusForm.php - Attach the settings form.
File
- modules/
ui/ src/ Form/ ElevateZoomPlusForm.php, line 264
Class
- ElevateZoomPlusForm
- Extends base form for elevatezoomplus instance configuration form.
Namespace
Drupal\elevatezoomplus_ui\FormCode
public function getFormElements() {
if (!isset($this->formElements)) {
$elements = [];
// @todo provide relevant respond options.
$elements['responsive'] = [
'type' => 'checkbox',
'title' => t('Responsive'),
'description' => t('Set to true to activate responsivenes. If you have a theme which changes size, or tablets which change orientation this is needed to be on.'),
'access' => FALSE,
];
$options = [
'inner' => 'Inner',
'lens' => 'Lens',
'window' => 'Window',
];
$elements['zoomType'] = [
'type' => 'select',
'title' => t('zoomType'),
'options' => $options,
'description' => t('The zoom type.'),
];
$elements['zoomWindowWidth'] = [
'type' => 'textfield',
'title' => t('zoomWindowWidth'),
'description' => t('Width of the zoomWindow (Note: zoomType must be "window").'),
];
$elements['zoomWindowHeight'] = [
'type' => 'textfield',
'title' => t('zoomWindowHeight'),
'description' => t('Height of the zoomWindow (Note: zoomType must be "window").'),
];
$elements['zoomWindowOffsetX'] = [
'type' => 'textfield',
'title' => t('zoomWindowOffsetX'),
'description' => t('The x-axis offset of the zoom window.'),
];
$elements['zoomWindowOffsetY'] = [
'type' => 'textfield',
'title' => t('zoomWindowOffsetY'),
'description' => t('The y-axis offset of the zoom window.'),
];
$elements['zoomWindowPosition'] = [
'type' => 'textfield',
'title' => t('zoomWindowPosition'),
'description' => t('Accepts a position, a selector or an element Id. For positions, once positioned, use zoomWindowOffsetX and zoomWindowOffsetY to adjust. Possible values: 1-16.'),
];
$elements['zoomWindowFadeIn'] = [
'type' => 'checkbox',
'title' => t('zoomWindowFadeIn'),
'description' => t('Set as a number e.g 200 for speed of Window fadeIn.'),
];
$elements['zoomWindowFadeOut'] = [
'type' => 'checkbox',
'title' => t('zoomWindowFadeOut'),
'description' => t('Set as a number e.g 200 for speed of Window fadeOut.'),
];
$elements['zoomTintFadeIn'] = [
'type' => 'checkbox',
'title' => t('zoomTintFadeIn'),
'description' => t('Set as a number e.g 200 for speed of Tint fadeIn.'),
];
$elements['zoomTintFadeOut'] = [
'type' => 'checkbox',
'title' => t('zoomTintFadeOut'),
'description' => t('Set as a number e.g 200 for speed of Tint fadeOut.'),
];
$elements['scrollZoom'] = [
'type' => 'checkbox',
'title' => t('scrollZoom'),
'description' => t('Set to true to activate zoom on mouse scroll.'),
];
$elements['imageCrossfade'] = [
'type' => 'checkbox',
'title' => t('imageCrossfade'),
'description' => t('Set to true to activate simultaneous crossfade of images on gallery change.'),
];
$elements['easing'] = [
'type' => 'checkbox',
'title' => t('easing'),
'description' => t('Set to true to activate easing.'),
];
$elements['easingType'] = [
'type' => 'textfield',
'title' => t('easingType'),
'description' => t('Default easing type is <code>easeOutExpo, (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b</code>. Extend jquery with other easing types before initiating the plugin and pass the easing type as a string value.'),
];
$elements['easingDuration'] = [
'type' => 'textfield',
'title' => t('easingDuration'),
'description' => t('The easing duration.'),
];
$elements['showLens'] = [
'type' => 'checkbox',
'title' => t('showLens'),
'description' => t('Set to false to hide the Lens.'),
];
$elements['lensSize'] = [
'type' => 'textfield',
'title' => t('lensSize'),
'description' => t('Used when zoomType set to lens, when zoom type is set to window, then the lens size is auto calculated.'),
];
$elements['lensFadeIn'] = [
'type' => 'checkbox',
'title' => t('lensFadeIn'),
'description' => t('Set as a number e.g 200 for speed of Lens fadeIn.'),
];
$elements['lensFadeOut'] = [
'type' => 'checkbox',
'title' => t('lensFadeOut'),
'description' => t('Set as a number e.g 200 for speed of Lens fadeOut.'),
];
$elements['borderSize'] = [
'type' => 'textfield',
'title' => t('borderSize'),
'description' => t('Border Size of the ZoomBox - Must be set here as border taken into account for plugin calculations.'),
];
$elements['borderColour'] = [
'type' => 'textfield',
'title' => t('borderColour'),
'description' => t('Border Color.'),
];
$elements['lensBorder'] = [
'type' => 'textfield',
'title' => t('lensBorder'),
'description' => t('Width in pixels of the lens border.'),
'field_suffix' => 'px',
];
$elements['lensShape'] = [
'type' => 'textfield',
'title' => t('lensShape'),
'description' => t('Can also be round (note that only modern browsers support round, will default to square in older browsers).'),
];
$elements['containLensZoom'] = [
'type' => 'checkbox',
'title' => t('containLensZoom'),
'description' => t('For use with the Lens Zoom Type. This makes sure the lens does not fall outside the outside of the image.'),
];
$elements['lensColour'] = [
'type' => 'textfield',
'title' => t('lensColour'),
'description' => t('Color of the lens background.'),
];
$elements['lensOpacity'] = [
'type' => 'textfield',
'title' => t('lensOpacity'),
'description' => t('Used in combination with lensColour to make the lens see through. When using tint, this is overrided to 0.'),
];
$elements['lenszoom'] = [
'type' => 'checkbox',
'title' => t('lenszoom'),
'description' => t('The lens zoom.'),
];
$elements['tint'] = [
'type' => 'checkbox',
'title' => t('tint'),
'description' => t('Enable a tint overlay.'),
];
$elements['tintColour'] = [
'type' => 'textfield',
'title' => t('tintColour'),
'description' => t('Color of the tint, can be #hex, word (red, blue), or rgb(x, x, x).'),
];
$elements['tintOpacity'] = [
'type' => 'textfield',
'title' => t('tintOpacity'),
'description' => t('Opacity of the tint.'),
];
$elements['constrainType'] = [
'type' => 'textfield',
'title' => t('constrainType'),
'description' => t('Constraint type.'),
];
$elements['constrainSize'] = [
'type' => 'textfield',
'title' => t('constrainSize'),
'description' => t('Constraint size.'),
];
// @todo exclude below from responsive options.
$elements['cursor'] = [
'type' => 'textfield',
'title' => t('cursor'),
'description' => t('The default cursor is usually the arrow, if using a lightbox, then set the cursor to pointer so it looks clickable - Options are default, cursor, crosshair.'),
];
// This has inconsistent schema, boolean vs string, adjust at front-end.
$elements['loadingIcon'] = [
'type' => 'textfield',
'title' => t('loadingIcon'),
'description' => t('Set to the url of the spinner icon to activate, e.g, http://www.example.com/spinner.gif.'),
];
// Defines the default values if available.
$defaults = ElevateZoomPlus::defaultSettings();
foreach ($elements as $name => $element) {
$fallback = $element['type'] == 'checkbox' ? FALSE : '';
$elements[$name]['default'] = isset($defaults[$name]) ? $defaults[$name] : $fallback;
}
$this->formElements = $elements;
}
return $this->formElements;
}