PluginProbe
Tableberg – Simple Gutenberg Table Block / 0.4.1
Tableberg – Simple Gutenberg Table Block v0.4.1
1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 0.5.8 All 41 releases
tableberg / includes / Defaults.php

Defaults.php in Tableberg – Simple Gutenberg Table Block 0.4.1, at includes/Defaults.php

209 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Default Attributes
4 *
5 * @package Tableberg
6 */
7
8 namespace Tableberg;
9
10 /**
11 * Handles default attributes of blocks.
12 */
13 class Defaults
14 {
15
16 /**
17 * Default Block Attributes
18 *
19 * @var array Block Attributes
20 */
21 public $default_values = array(
22 'tableberg/table' => array(
23 'attributes' => array(
24 'rows' => array(
25 'type' => 'number',
26 'default' => 2,
27 ),
28 'cols' => array(
29 'type' => 'number',
30 'default' => 2,
31 ),
32 'colWidths' => array(
33 'type' => 'array',
34 'default' => ['', ''],
35 ),
36 'rowHeights' => array(
37 'type' => 'array',
38 'default' => ['', ''],
39 ),
40 'hasTableCreated' => array(
41 'type' => 'boolean',
42 'default' => false,
43 ),
44 'cellPadding' => array(
45 'type' => 'array',
46 'default' => array(),
47 ),
48 'enableTableHeader' => array(
49 'type' => 'string',
50 'default' => '',
51 ),
52 'enableTableFooter' => array(
53 'type' => 'string',
54 'default' => '',
55 ),
56 'tableWidth' => array(
57 'type' => 'string',
58 'default' => '',
59 ),
60 'tableAlignment' => array(
61 'type' => 'string',
62 'default' => 'center',
63 ),
64 'headerBackgroundColor' => array(
65 'type' => 'string',
66 'default' => null,
67 ),
68 'evenRowBackgroundColor' => array(
69 'type' => 'string',
70 'default' => null,
71 ),
72 'oddRowBackgroundColor' => array(
73 'type' => 'string',
74 'default' => null,
75 ),
76 'footerRowBackgroundColor' => array(
77 'type' => 'string',
78 'default' => null,
79 ),
80 'tableBorder' => array(
81 'type' => 'object',
82 'default' => array(),
83 ),
84 'innerBorder' => array(
85 'type' => 'object',
86 'default' => array(),
87 ),
88 'enableInnerBorder' => array(
89 'type' => 'boolean',
90 'default' => true,
91 ),
92 ),
93 ),
94 'tableberg/cell' => array(
95 'attributes' => array(
96 'vAlign' => [
97 'type' => 'string',
98 'default' => 'center'
99 ],
100 'tagName' => [
101 'type' => 'string',
102 'default' => 'td'
103 ],
104 'rowspan' => [
105 'type' => 'number',
106 'default' => 1
107 ],
108 'colspan' => [
109 'type' => 'number',
110 'default' => 1
111 ],
112 'row' => [
113 'type' => 'number',
114 'default' => 0
115 ],
116 'col' => [
117 'type' => 'number',
118 'default' => 0
119 ]
120 ),
121 ),
122 'tableberg/image' => array(
123 'attributes' => array(
124 'media' => array(
125 'type' => 'object',
126 'default' => array(),
127 ),
128 'height' => array(
129 'type' => 'string',
130 'default' => '',
131 ),
132 'width' => array(
133 'type' => 'string',
134 'default' => '',
135 ),
136 'alt' => array(
137 'type' => 'string',
138 'default' => '',
139 ),
140 'aspectRatio' => array(
141 'type' => 'string',
142 'default' => '',
143 ),
144 'scale' => array(
145 'type' => 'string',
146 'default' => '',
147 ),
148 'sizeSlug' => array(
149 'type' => 'string',
150 'default' => 'large',
151 ),
152 'caption' => array(
153 'type' => 'string',
154 'default' => '',
155 ),
156 'href' => array(
157 'type' => 'string',
158 'default' => '',
159 ),
160 'linkClass' => array(
161 'type' => 'string',
162 'default' => '',
163 ),
164 'linkDestination' => array(
165 'type' => 'string',
166 'default' => '',
167 ),
168 'rel' => array(
169 'type' => 'string',
170 'default' => '',
171 ),
172 'linkTarget' => array(
173 'type' => 'string',
174 'default' => '',
175 ),
176 'border' => array(
177 'type' => 'object',
178 'default' => array(),
179 ),
180 'borderRadius' => array(
181 'type' => 'object',
182 'default' => array(),
183 ),
184 ),
185 ),
186 );
187
188
189 /**
190 * Constructor
191 *
192 * @return void
193 */
194 public function __construct()
195 {
196 }
197
198 /**
199 * Get block default attributes with block name.
200 *
201 * @param string $block_name block name.
202 * @return array block attributes
203 */
204 public function get_default_attributes($block_name)
205 {
206 return $this->default_values[$block_name]['attributes'];
207 }
208 }
209