PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.1.5
Tableberg – Simple Gutenberg Table Block v1.1.5
1.1.5 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 All 42 releases
tableberg / renderer / CustomHtml / CustomHtmlAttrs.php

CustomHtmlAttrs.php in Tableberg – Simple Gutenberg Table Block 1.1.5, at renderer/CustomHtml/CustomHtmlAttrs.php

38 lines 839 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Tableberg\Renderer\CustomHtml;
4
5 use Tableberg\Renderer\Attrs\StringAttr;
6
7 use function Tableberg\Renderer\getOrNull;
8
9 class CustomHtmlAttrs {
10 /** @var StringAttr */
11 public $content;
12
13 /** @var StringAttr */
14 public $align;
15
16 /**
17 * @param array<string, mixed>|null $data
18 * @return self
19 */
20 public static function from_array($data) {
21 $data = is_array($data) ? $data : [];
22 $defaults = Defaults::get_defaults();
23
24 $instance = new self();
25 $instance->content = new StringAttr(
26 getOrNull($data['content']),
27 $defaults['content']
28 );
29 $instance->align = new StringAttr(
30 getOrNull($data['align']),
31 $defaults['align'],
32 ['left', 'center', 'right']
33 );
34
35 return $instance;
36 }
37 }
38