Skip to content
Snippets Groups Projects
Commit 0db6843c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2847657 by jibran, xjm: ViewsBlockBase doesn't expose parent view and display info

parent f6fa46e5
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -24,9 +24,23 @@ public function getCacheContexts() { ...@@ -24,9 +24,23 @@ public function getCacheContexts() {
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @return array
* A renderable array representing the content of the block with additional
* context of current view and display ID.
*/ */
public function build() { public function build() {
$output = $this->view->display_handler->viewExposedFormBlocks(); $output = $this->view->display_handler->viewExposedFormBlocks();
// Provide the context for block build and block view alter hooks.
// \Drupal\views\Plugin\Block\ViewsBlock::build() adds the same context in
// \Drupal\views\ViewExecutable::buildRenderable() using
// \Drupal\views\Plugin\views\display\DisplayPluginBase::buildRenderable().
if (is_array($output) && !empty($output)) {
$output += [
'#view' => $this->view,
'#display_id' => $this->displayID,
];
}
// Before returning the block output, convert it to a renderable array with // Before returning the block output, convert it to a renderable array with
// contextual links. // contextual links.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment