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
← All changes | renderer/Table/InnerBlocksAttrsAdapter.php +14 -12 1.1.11.1.5 View file →
@@ -37,13 +37,12 @@
37 37
38 38 $rowAttrs = isset($rowBlock['attrs']) && is_array($rowBlock['attrs'])
39 39 ? $rowBlock['attrs']
40 40 : [];
41 - if (isset($rowAttrs['height']) && is_string($rowAttrs['height']) && $rowAttrs['height'] !== '') {
42 - $rowConfigs[$row] = ['height' => $rowAttrs['height']];
43 - } else {
44 - $rowConfigs[$row] = null;
45 - }
41 + // Pass every row attribute through untouched (not just `height`)
42 + // so pro-registered keys survive without this adapter needing to
43 + // know their names.
44 + $rowConfigs[$row] = empty($rowAttrs) ? null : $rowAttrs;
46 45
47 46 $col = 0;
48 47 $rowInner = isset($rowBlock['innerBlocks']) && is_array($rowBlock['innerBlocks'])
49 48 ? $rowBlock['innerBlocks']
@@ -66,14 +65,13 @@
66 65 $cellAttrs = isset($cellBlock['attrs']) && is_array($cellBlock['attrs'])
67 66 ? $cellBlock['attrs']
68 67 : [];
69 68
70 - $cellEntry = [];
71 - foreach (['span', 'styles', 'ribbon', 'className'] as $key) {
72 - if (isset($cellAttrs[$key])) {
73 - $cellEntry[$key] = $cellAttrs[$key];
74 - }
75 - }
69 + // Everything the cell block carries is passed straight
70 + // through, not just the keys this file knows about. Pro
71 + // registers its own cell attributes, and they have to reach
72 + // its renderer without free having to name them here.
73 + $cellEntry = $cellAttrs;
76 74
77 75 $cellEntry['elements'] = self::to_elements(
78 76 isset($cellBlock['innerBlocks']) && is_array($cellBlock['innerBlocks'])
79 77 ? $cellBlock['innerBlocks']
@@ -118,11 +116,15 @@
118 116
119 117 $row++;
120 118 }
121 119
120 + // When the whole object is absent Gutenberg supplies the block
121 + // schema's complete default. Starting from an empty array here would
122 + // create a partial object just to add row/column counts and would
123 + // silently lose nested defaults such as search.placeholder.
122 124 $table = isset($attrs['table']) && is_array($attrs['table'])
123 125 ? $attrs['table']
124 - : [];
126 + : TableAttrs::get_table_defaults();
125 127 $table['rows'] = $row;
126 128 $table['cols'] = $colsCount;
127 129
128 130 $adapted = $attrs;