Skip to content

Commit

Permalink
Add little check to fix notice if a block is no more available
Browse files Browse the repository at this point in the history
  • Loading branch information
jf-viguier committed Aug 30, 2023
1 parent addead0 commit 66c9ebd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions classes/PrettyBlocksModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,11 @@ public static function getBlocksAvailable()
$data[0] = $data;
}
foreach ($data as $block) {
$blocks[$block['code']] = $block;
// formatted for LeftPanel.vue
$blocks[$block['code']]['formatted'] = self::formatBlock($block);
if (!empty($block['code'])) {
$blocks[$block['code']] = $block;
// formatted for LeftPanel.vue
$blocks[$block['code']]['formatted'] = self::formatBlock($block);
}
}
}

Expand All @@ -684,7 +686,7 @@ private static function formatBlock($block)
$formatted['icon'] = $block['icon'] ?? 'PhotographIcon';
$formatted['icon_path'] = $block['icon_path'] ?? '';
$formatted['module'] = $block['code']; // todo register module name
$formatted['title'] = $block['name'];
$formatted['title'] = $block['name'] ?? '';
// dump($block);

// if nameFrom params is present
Expand Down

0 comments on commit 66c9ebd

Please sign in to comment.