public function PanelsIPEPageController::getBlock in Panels 8.3
Same name and namespace in other branches
- 8.4 panels_ipe/src/Controller/PanelsIPEPageController.php \Drupal\panels_ipe\Controller\PanelsIPEPageController::getBlock()
Gets a single Block from the current Panels Display. Uses TempStore.
Parameters
string $panels_storage_type: The id of the storage plugin.
string $panels_storage_id: The id within the storage plugin for the requested Panels display.
string $block_uuid: The Block UUID.
Return value
\Symfony\Component\HttpFoundation\JsonResponse
1 string reference to 'PanelsIPEPageController::getBlock'
- panels_ipe.routing.yml in panels_ipe/
panels_ipe.routing.yml - panels_ipe/panels_ipe.routing.yml
File
- panels_ipe/
src/ Controller/ PanelsIPEPageController.php, line 454
Class
- PanelsIPEPageController
- Contains all JSON endpoints required for Panels IPE + Page Manager.
Namespace
Drupal\panels_ipe\ControllerCode
public function getBlock($panels_storage_type, $panels_storage_id, $block_uuid) {
$panels_display = $this
->loadPanelsDisplay($panels_storage_type, $panels_storage_id);
/** @var \Drupal\Core\Block\BlockBase $block_instance */
$block_instance = $panels_display
->getBlock($block_uuid);
$block_config = $block_instance
->getConfiguration();
// Assemble data required for our App.
$build = $this
->buildBlockInstance($block_instance, $panels_display);
// Bubble Block attributes to fix bugs with the Quickedit and Contextual
// modules.
$this
->bubbleBlockAttributes($build);
// Add our data attribute for the Backbone app.
$build['#attributes']['data-block-id'] = $block_uuid;
$plugin_definition = $block_instance
->getPluginDefinition();
$block_model = [
'uuid' => $block_uuid,
'label' => $block_instance
->label(),
'id' => $block_instance
->getPluginId(),
'region' => $block_config['region'],
'provider' => $block_config['provider'],
'plugin_id' => $plugin_definition['id'],
'html' => $this->renderer
->render($build),
];
return new JsonResponse($block_model);
}