protected function BlockVisibilityGroupDeleteForm::getBlocksForGroup in Block Visibility Groups 8
Get all blocks in the Visibility Group.
Return value
array The blocks for the group.
2 calls to BlockVisibilityGroupDeleteForm::getBlocksForGroup()
- BlockVisibilityGroupDeleteForm::buildForm in src/
Form/ BlockVisibilityGroupDeleteForm.php - Form constructor.
- BlockVisibilityGroupDeleteForm::submitForm in src/
Form/ BlockVisibilityGroupDeleteForm.php - This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
File
- src/
Form/ BlockVisibilityGroupDeleteForm.php, line 99
Class
- BlockVisibilityGroupDeleteForm
- Builds the form to delete Block Visibility Group entities.
Namespace
Drupal\block_visibility_groups\FormCode
protected function getBlocksForGroup() {
/** @var \Drupal\block\Entity\Block[] $all_blocks */
$all_blocks = $this
->blockStorage()
->loadMultiple();
$group_blocks = [];
foreach ($all_blocks as $block) {
if ($this
->getGroupForBlock($block) == $this->entity
->id()) {
$group_blocks[$block
->id()] = $block;
}
}
return $group_blocks;
}