Commit e7b687af authored by catch's avatar catch
Browse files

Issue #3296112 by Spokje, dww, catch, smustgrave: Remove...

Issue #3296112 by Spokje, dww, catch, smustgrave: Remove ViewsConfigUpdater::processSortFieldIdentifierUpdateHandler

(cherry picked from commit 0d85f5f3)
parent 66d46fc1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ display:
          order: ASC
          expose:
            label: 'Moderation state'
            field_identifier: moderation_state
          exposed: true
      arguments: {  }
      filters: {  }
+1 −0
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ display:
          order: ASC
          expose:
            label: 'Moderation state'
            field_identifier: moderation_state
          exposed: true
      arguments: {  }
      filters: {  }
+0 −37
Original line number Diff line number Diff line
@@ -122,9 +122,6 @@ public function setDeprecationsEnabled($enabled) {
  public function updateAll(ViewEntityInterface $view) {
    return $this->processDisplayHandlers($view, FALSE, function (&$handler, $handler_type, $key, $display_id) use ($view) {
      $changed = FALSE;
      if ($this->processSortFieldIdentifierUpdateHandler($handler, $handler_type)) {
        $changed = TRUE;
      }
      if ($this->processImageLazyLoadFieldHandler($handler, $handler_type, $view)) {
        $changed = TRUE;
      }
@@ -173,21 +170,6 @@ protected function processDisplayHandlers(ViewEntityInterface $view, $return_on_
    return $changed;
  }

  /**
   * Updates the sort handlers by adding default sort field identifiers.
   *
   * @param \Drupal\views\ViewEntityInterface $view
   *   The View to update.
   *
   * @return bool
   *   Whether the view was updated.
   */
  public function needsSortFieldIdentifierUpdate(ViewEntityInterface $view): bool {
    return $this->processDisplayHandlers($view, TRUE, function (array &$handler, string $handler_type): bool {
      return $this->processSortFieldIdentifierUpdateHandler($handler, $handler_type);
    });
  }

  /**
   * Add lazy load options to all image type field configurations.
   *
@@ -232,23 +214,4 @@ protected function processImageLazyLoadFieldHandler(array &$handler, string $han
    return $changed;
  }

  /**
   * Processes sort handlers by adding the sort identifier.
   *
   * @param array $handler
   *   A display handler.
   * @param string $handler_type
   *   The handler type.
   *
   * @return bool
   *   Whether the handler was updated.
   */
  protected function processSortFieldIdentifierUpdateHandler(array &$handler, string $handler_type): bool {
    if ($handler_type === 'sort' && !isset($handler['expose']['field_identifier'])) {
      $handler['expose']['field_identifier'] = $handler['id'];
      return TRUE;
    }
    return FALSE;
  }

}
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ display:
          order: asc
          expose:
            label: 'id'
            field_identifier: id
          exposed: true
          plugin_id: standard
    display_plugin: default