124 $allowedManifestKeys = [
132 $manifest = array_filter(
134 function (
$key) use ($allowedManifestKeys) {
135 return in_array(mb_strtolower(
$key), $allowedManifestKeys);
140 $manifest[
'block'][
'type'] = (
array)$manifest[
'block'][
'type'];
143 if (isset($manifest[
'assets']))
147 'landing_inline_video',
150 $manifest[
'assets'] = [
151 'ext' => array_filter(
152 (
array)$manifest[
'assets'][
'ext'],
153 function ($item) use ($allowedExt)
155 return in_array(mb_strtolower($item), $allowedExt);
160 if (empty($manifest[
'assets'][
'ext']))
162 unset($manifest[
'assets']);
167 if (isset($manifest[
'block'][
'subtype']))
172 $manifest[
'block'][
'subtype'] = array_filter(
173 (
array)$manifest[
'block'][
'subtype'],
174 function ($item) use ($allowedSubtypes) {
175 return in_array(mb_strtolower($item), $allowedSubtypes);
179 if (empty($manifest[
'block'][
'subtype']))
181 unset($manifest[
'block'][
'subtype'], $manifest[
'block'][
'subtype_params']);
185 if (isset($manifest[
'callbacks']))
187 $allowedCallbacks = [
191 $manifest[
'callbacks'] = array_filter(
192 (
array)$manifest[
'callbacks'],
193 function ($item) use ($allowedCallbacks) {
194 return in_array(mb_strtolower($item), $allowedCallbacks);
199 if (empty($manifest[
'callbacks']))
201 unset($manifest[
'callbacks']);
227 'height-increased--md',
230 if (isset($manifest[
'style'][
'block'][
'type']))
232 $manifest[
'style'][
'block'][
'type'] = (
array)$manifest[
'style'][
'block'][
'type'];
233 $manifest[
'block'][
'section'] = (
array)$manifest[
'block'][
'section'];
234 $filtered = array_intersect($manifest[
'style'][
'block'][
'type'], $allowedStyles);
235 $manifest[
'style'][
'block'][
'type'] = array_values($filtered);
237 !in_array(
'widget-type', $manifest[
'style'][
'block'][
'type'],
true)
238 && !in_array(
'widgets_separators', $manifest[
'block'][
'section'],
true)
241 $manifest[
'style'][
'block'][
'type'][] =
'widget-type';
245 foreach (($manifest[
'style'][
'nodes'] ?? []) as &$node)
247 $node[
'type'] = (
array)$node[
'type'];
248 $node[
'type'] = array_values(array_intersect($node[
'type'], $allowedStyles));
254 isset($manifest[
'style'])
255 && !isset($manifest[
'style'][
'block'])
256 && !isset($manifest[
'style'][
'nodes'])
259 foreach ($manifest[
'style'] as &$node)
261 $node[
'type'] = (
array)$node[
'type'];
262 $node[
'type'] = array_values(array_intersect($node[
'type'], $allowedStyles));