Yaffs site version 1.1
[yaffs-website] / web / modules / contrib / blazy / src / Dejavu / BlazyDefault.php
1 <?php
2
3 namespace Drupal\blazy\Dejavu;
4
5 /**
6  * Defines shared plugin default settings for field formatter and Views style.
7  *
8  * @todo: Consider moving this into Drupal\blazy namespace.
9  */
10 class BlazyDefault {
11
12   /**
13    * The supported $breakpoints.
14    *
15    * @var array
16    */
17   private static $breakpoints = ['xs', 'sm', 'md', 'lg', 'xl'];
18
19   /**
20    * Returns Blazy specific breakpoints.
21    */
22   public static function getConstantBreakpoints() {
23     return self::$breakpoints;
24   }
25
26   /**
27    * Returns basic plugin settings.
28    */
29   public static function baseSettings() {
30     return [
31       'cache'             => 0,
32       'current_view_mode' => '',
33       'optionset'         => 'default',
34       'skin'              => '',
35       'style'             => '',
36     ];
37   }
38
39   /**
40    * Returns image-related field formatter and Views settings.
41    */
42   public static function baseImageSettings() {
43     return [
44       'background'             => FALSE,
45       'box_caption'            => '',
46       'box_caption_custom'     => '',
47       'box_style'              => '',
48       'box_media_style'        => '',
49       'breakpoints'            => [],
50       'caption'                => [],
51       'image_style'            => '',
52       'media_switch'           => '',
53       'ratio'                  => '',
54       'responsive_image_style' => '',
55       'sizes'                  => '',
56     ];
57   }
58
59   /**
60    * Returns image-related field formatter and Views settings.
61    */
62   public static function imageSettings() {
63     return [
64       'iframe_lazy'     => TRUE,
65       'icon'            => '',
66       'layout'          => '',
67       'thumbnail_style' => '',
68       'view_mode'       => '',
69     ] + self::baseSettings() + self::baseImageSettings();
70   }
71
72   /**
73    * Returns Views specific settings.
74    */
75   public static function viewsSettings() {
76     return [
77       'class'   => '',
78       'id'      => '',
79       'image'   => '',
80       'link'    => '',
81       'overlay' => '',
82       'title'   => '',
83       'vanilla' => FALSE,
84     ];
85   }
86
87   /**
88    * Returns fieldable entity formatter and Views settings.
89    */
90   public static function extendedSettings() {
91     return self::viewsSettings() + self::imageSettings();
92   }
93
94   /**
95    * Returns optional grid field formatter and Views settings.
96    */
97   public static function gridSettings() {
98     return [
99       'grid'        => 0,
100       'grid_header' => '',
101       'grid_medium' => 0,
102       'grid_small'  => 0,
103       'style'       => '',
104     ];
105   }
106
107   /**
108    * Returns sensible default options common for entities lacking of UI.
109    */
110   public static function entitySettings() {
111     return [
112       'blazy'        => TRUE,
113       'iframe_lazy'  => TRUE,
114       'lazy'         => 'blazy',
115       'media_switch' => 'media',
116       'ratio'        => 'fluid',
117       'rendered'     => FALSE,
118       'view_mode'    => 'default',
119       '_detached'    => TRUE,
120     ];
121   }
122
123 }