View source
<?php
namespace Drupal\blazy;
class BlazyDefault {
private static $breakpoints = [
'xs',
'sm',
'md',
'lg',
'xl',
];
const TAGS = [
'a',
'em',
'strong',
'h2',
'p',
'span',
'ul',
'ol',
'li',
];
private static $instance = NULL;
private static $alterableSettings;
public static function getInstance() {
if (is_null(self::$instance)) {
self::$instance = new BlazyDefault();
}
return self::$instance;
}
public static function getConstantBreakpoints() {
return self::$breakpoints;
}
public function alterableSettings(array &$settings = []) {
if (!isset(static::$alterableSettings)) {
$context = [
'class' => get_called_class(),
];
\Drupal::moduleHandler()
->alter('blazy_base_settings', $settings, $context);
static::$alterableSettings = $settings;
}
return static::$alterableSettings;
}
public static function baseSettings() {
$settings = [
'cache' => 0,
'current_view_mode' => '',
'optionset' => 'default',
'skin' => '',
'style' => '',
];
blazy_alterable_settings($settings);
return $settings;
}
public static function baseImageSettings() {
return [
'background' => FALSE,
'box_caption' => '',
'box_caption_custom' => '',
'box_style' => '',
'box_media_style' => '',
'breakpoints' => [],
'caption' => [],
'image_style' => '',
'media_switch' => '',
'ratio' => '',
'responsive_image_style' => '',
'sizes' => '',
];
}
public static function imageSettings() {
return [
'iframe_lazy' => TRUE,
'icon' => '',
'layout' => '',
'thumbnail_style' => '',
'view_mode' => '',
] + self::baseSettings() + self::baseImageSettings();
}
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,
'style' => '',
];
}
public static function lazySettings() {
return [
'blazy' => TRUE,
'lazy' => 'blazy',
'ratio' => 'fluid',
];
}
public static function entitySettings() {
return [
'iframe_lazy' => TRUE,
'media_switch' => 'media',
'rendered' => FALSE,
'view_mode' => 'default',
'_detached' => TRUE,
] + self::lazySettings();
}
public static function uiSettings() {
return [
'one_pixel' => TRUE,
'responsive_image' => FALSE,
'theme_hook_image' => 'blazy',
];
}
public static function itemSettings() {
return [
'blazy_data' => [],
'classes' => [],
'content_url' => '',
'delta' => 0,
'embed_url' => '',
'entity_type_id' => '',
'extension' => '',
'icon' => '',
'image_url' => '',
'id' => '',
'item_id' => 'blazy',
'lazy_attribute' => 'src',
'lazy_class' => 'b-lazy',
'lightbox' => FALSE,
'namespace' => 'blazy',
'player' => FALSE,
'scheme' => '',
'type' => 'image',
'uri' => '',
'use_image' => FALSE,
'use_media' => FALSE,
'height' => NULL,
'width' => NULL,
] + self::imageSettings() + self::uiSettings();
}
public static function themeProperties() {
return [
'attributes',
'captions',
'image',
'item',
'item_attributes',
'settings',
'url',
];
}
public static function themeAttributes() {
return [
'caption',
'media',
'url',
'wrapper',
];
}
}