public function ParagraphBlocksLabeller::hookPanelsIpeBlocksAlter in Paragraph blocks 8.2
Same name and namespace in other branches
- 3.x src/ParagraphBlocksLabeller.php \Drupal\paragraph_blocks\ParagraphBlocksLabeller::hookPanelsIpeBlocksAlter()
Removes unused paragraphs and update the panels title.
Parameters
array $blocks: The blocks.
See also
hook_panels_ipe_blocks_alter()
File
- src/
ParagraphBlocksLabeller.php, line 88
Class
- ParagraphBlocksLabeller
- Labels the paragraph blocks once the entity context is known.
Namespace
Drupal\paragraph_blocksCode
public function hookPanelsIpeBlocksAlter(array &$blocks) {
// Loop through all of the blocks.
foreach ($blocks as $delta => $block) {
$title = $this
->getTitle($block['plugin_id'], $enabled);
if ($title === FALSE) {
// Remove the block if there is no paragraph data for the delta.
unset($blocks[$delta]);
}
elseif ($title !== NULL) {
// Replace the title.
$blocks[$delta]['label'] = $title;
}
}
}