Verified Commit fd9ecc17 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3230681 by andregp, hmendes, narendra.rajwar27, Chi, jobsons, catch,...

Issue #3230681 by andregp, hmendes, narendra.rajwar27, Chi, jobsons, catch, Eugene Bocharov, alexpott: ViewsExposedFilterBlock::build must always return array

(cherry picked from commit f6bd3a52)
parent 6d55a8f3
Loading
Loading
Loading
Loading
+3 −3
Changes for core/modules/views/src/Plugin/Block/ViewsExposedFilterBlock.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -31,13 +31,13 @@ public function getCacheContexts() {
   *   A renderable array representing the content of the block with additional
   *   context of current view and display ID.
   */
  public function build() {
    $output = $this->view->display_handler->viewExposedFormBlocks();
  public function build() : array {
    $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)) {
    if (!empty($output)) {
      $output += [
        '#view' => $this->view,
        '#display_id' => $this->displayID,