View source
<?php
namespace Drupal\blazy;
class BlazyDefault {
const TAGS = [
'a',
'em',
'strong',
'h2',
'p',
'span',
'ul',
'ol',
'li',
];
private static $instance = NULL;
public static function getInstance() {
if (is_null(self::$instance)) {
self::$instance = new BlazyDefault();
}
return self::$instance;
}
public static function getConstantBreakpoints() {
return [
'xs',
'sm',
'md',
'lg',
'xl',
];
}
public function alterableSettings(array &$settings = []) {
$context = [
'class' => get_called_class(),
];
\Drupal::moduleHandler()
->alter('blazy_base_settings', $settings, $context);
return $settings;
}
public static function anywhereSettings() {
return [
'fx' => '',
'style' => '',
];
}
public static function baseSettings() {
$settings = [
'cache' => 0,
'current_view_mode' => '',
'skin' => '',
] + self::anywhereSettings();
blazy_alterable_settings($settings);
return $settings;
}
public static function cherrySettings() {
return [
'box_style' => '',
'image_style' => '',
'media_switch' => '',
'ratio' => '',
'thumbnail_style' => '',
'_uri' => '',
];
}
public static function baseImageSettings() {
return [
'background' => FALSE,
'box_caption' => '',
'box_caption_custom' => '',
'box_media_style' => '',
'caption' => [],
'responsive_image_style' => '',
] + self::cherrySettings();
}
public static function deprecatedSettings() {
return [
'breakpoints' => [],
'sizes' => '',
'grid_header' => '',
];
}
public static function imageSettings() {
return [
'icon' => '',
'layout' => '',
'view_mode' => '',
] + self::baseSettings() + self::baseImageSettings() + self::deprecatedSettings();
}
public static function viewsSettings() {
return [
'class' => '',
'id' => '',
'image' => '',
'link' => '',
'overlay' => '',
'title' => '',
'vanilla' => FALSE,
];
}
public static function extendedSettings() {
return self::viewsSettings() + self::imageSettings();
}
public static function gridSettings() {
return [
'grid' => 0,
'grid_header' => '',
'grid_medium' => 0,
'grid_small' => 0,
] + self::anywhereSettings();
}
public static function lazySettings() {
return [
'blazy' => TRUE,
'lazy' => 'blazy',
'ratio' => 'fluid',
];
}
public static function entitySettings() {
return [
'media_switch' => 'media',
'rendered' => FALSE,
'view_mode' => 'default',
'_detached' => TRUE,
] + self::lazySettings();
}
public static function richSettings() {
return [
'background' => FALSE,
'lazy' => '',
'lightbox' => FALSE,
'media_switch' => '',
'placeholder' => '',
'resimage' => FALSE,
'use_loading' => FALSE,
'type' => 'rich',
] + self::anywhereSettings();
}
public static function uiSettings() {
return [
'decode' => FALSE,
'one_pixel' => TRUE,
'noscript' => FALSE,
'placeholder' => '',
'responsive_image' => FALSE,
'unstyled_extensions' => '',
] + self::anywhereSettings();
}
public static function htmlSettings() {
return [
'blazy_data' => [],
'lightbox' => FALSE,
'namespace' => 'blazy',
'id' => '',
'is_preview' => FALSE,
'_richbox' => FALSE,
'route_name' => '',
'use_field' => FALSE,
'unstyled' => FALSE,
'view_name' => '',
] + self::imageSettings() + self::uiSettings();
}
public static function itemSettings() {
return [
'_api' => FALSE,
'bundle' => '',
'classes' => [],
'content_url' => '',
'delta' => 0,
'embed_url' => '',
'entity_type_id' => '',
'extension' => '',
'image_url' => '',
'item_id' => 'blazy',
'lazy_attribute' => 'src',
'lazy_class' => 'b-lazy',
'padding_bottom' => '',
'placeholder_fx' => '',
'placeholder_ui' => '',
'player' => FALSE,
'resimage' => FALSE,
'scheme' => '',
'type' => 'image',
'uri' => '',
'use_data_uri' => FALSE,
'use_loading' => TRUE,
'use_media' => FALSE,
'height' => NULL,
'width' => NULL,
] + self::htmlSettings();
}
public static function themeProperties() {
return [
'attributes',
'captions',
'content',
'iframe',
'image',
'icon',
'item',
'item_attributes',
'noscript',
'overlay',
'preface',
'postscript',
'settings',
'url',
];
}
public static function themeAttributes() {
return [
'caption',
'media',
'url',
'wrapper',
];
}
}