[PP-1] Allow the ProjectBrowser render element to customize the available sort options

Created on 5 March 2025, 2 months ago

Problem/Motivation

This is postponed on Allow the frontend code to be initialized with a preconfigured query Active .

In that issue, we started to add some degree of display customizability to project browsers -- really, it's more about enabling or disabling certain parts of the "chrome" (i.e., filters, sorts, pagination, etc.)

At the moment, there is no way to disable certain filters from showing up. All of the filters defined by the source will appear. For mini-browsers, this might not be desirable.

Proposed resolution

Add a #filters property to the ProjectBrowser render element. If provided, it is an associative array whose keys are the machine names of the filters, and whose values are the default values for those filters. Every key must match the name of a filter defined by the source's getFilterDefinitions() method.

Example (assuming the source is

drupalorg_jsonapi<code>):

<code>
$element['#filters'] = [
  'development_status' => TRUE,
  'categories' => [123, 456],   // The taxonomy IDs for the categories to choose
];

This will suppress the display of all filters except these two, and it will adjust the default values of these two filters from whatever the source originally set.

ProjectBrowserBlock should also add this to its configuration form, in a limited way. It won't be able to set the default values (yet), but it will be able to enable or disable the filters. The filters will be presented as a set of checkboxes, keyed by internal name, labeled by human-readable name. All will be selected by default. The final selection is stored in block settings as an array of filter names (['development_status', 'categories', ...]), and applied to the render element during the build() method to show or hide certain filters.

Feature request
Status

Postponed

Version

2.0

Component

Code

Created by

🇺🇸United States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • 🇺🇸United States phenaproxima Massachusetts
  • 🇺🇸United States phenaproxima Massachusetts
  • 🇺🇸United States phenaproxima Massachusetts
  • 🇺🇸United States phenaproxima Massachusetts

    Blocker is committed, so assigning this one to @narendrar.

  • First commit to issue fork.
  • Merge request !777Initial commit → (Merged) created by narendraR
  • Pipeline finished with Failed
    2 months ago
    Total: 531s
    #441817
  • Pipeline finished with Canceled
    2 months ago
    Total: 341s
    #442009
  • Pipeline finished with Failed
    2 months ago
    #442015
  • Pipeline finished with Failed
    2 months ago
    Total: 447s
    #442025
  • Pipeline finished with Failed
    2 months ago
    Total: 997s
    #442062
  • Pipeline finished with Success
    2 months ago
    Total: 368s
    #442073
  • 🇮🇳India narendraR Jaipur, India
  • Pipeline finished with Success
    2 months ago
    Total: 466s
    #442136
  • Pipeline finished with Success
    2 months ago
    Total: 387s
    #442140
  • Pipeline finished with Canceled
    2 months ago
    Total: 188s
    #442166
  • Pipeline finished with Failed
    2 months ago
    Total: 377s
    #442167
  • Pipeline finished with Failed
    2 months ago
    Total: 493s
    #442195
  • 🇺🇸United States phenaproxima Massachusetts
  • Pipeline finished with Failed
    2 months ago
    Total: 1086s
    #442207
  • 🇺🇸United States phenaproxima Massachusetts
  • Pipeline finished with Success
    2 months ago
    Total: 664s
    #442225
  • Pipeline finished with Failed
    2 months ago
    Total: 469s
    #442241
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    I'm not sure about the machine names. Not strongly against it, but we cannot restrict what an external source will define which might still be valid aside of this. Restricting just for the block could be confusing.

    Functionality wise, works as expected.

  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    Great work!

  • Pipeline finished with Success
    2 months ago
    Total: 475s
    #442324
  • First commit to issue fork.
  • Pipeline finished with Skipped
    about 2 months ago
    #446653
  • 🇺🇸United States chrisfromredfin Portland, Maine

    Thanks for the work! Good to see you in the queue, penyaskito!

  • Pipeline finished with Success
    about 2 months ago
    Total: 6309s
    #447049
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 964s
    #447462
  • Pipeline finished with Success
    about 2 months ago
    Total: 941s
    #447480
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024