Commit 4c2cb08b authored by Marcin Grabias's avatar Marcin Grabias
Browse files

Issue #3263678 by prudloff: VBO not initialized correctly when a page contains...

Issue #3263678 by prudloff: VBO not initialized correctly when a page contains views with different providers
parent 5f466127
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ class ViewsBulkOperationsViewData implements ViewsBulkOperationsViewDataInterfac
   *
   * @var array
   */
  protected $data;
  protected $data = [];

  /**
   * Entity type ids returned by this view.
@@ -112,18 +112,21 @@ class ViewsBulkOperationsViewData implements ViewsBulkOperationsViewDataInterfac
   *   Part of views data that refers to the current view.
   */
  protected function getData() {
    if (!$this->data) {
      $viewsData = Views::viewsData();
    if (!empty($this->relationship) && $this->relationship != 'none') {
      $relationship = $this->displayHandler->getOption('relationships')[$this->relationship];
      $table_data = $viewsData->get($relationship['table']);
        $this->data = $viewsData->get($table_data[$relationship['field']]['relationship']['base']);
      $key = $table_data[$relationship['field']]['relationship']['base'];
    }
    else {
        $this->data = $viewsData->get($this->view->storage->get('base_table'));
      $key = $this->view->storage->get('base_table');
    }

    if (!array_key_exists($key, $this->data)) {
      $viewsData = Views::viewsData();
      $this->data[$key] = $viewsData->get($key);
    }
    return $this->data;

    return $this->data[$key];
  }

  /**