Problem/Motivation

It's likely that Drupal CMS will want to expose miniature project browsers that display small, curated lists of projects from various sources.

It's already possible to choose which projects to display by tailoring the queries (i.e., ProjectBrowserSourceInterface::getProjects($query)) precisely, but it's not possible to control the order in which those projects appear. But that's an important part of curation, and will almost certainly be asked for.

Proposed resolution

Create an API that allow individual sources to return their projects in an arbitrary order defined in the plugin configuration.

This should take the form of a static helper function that sources can use if they want to: sortByDefinedOrder($projects, $order). $order is an array of unqualified project IDs. The sorting algorithm will automatically move any projects listed in $order to the top of the list, and then sort those to match what's in $order.

Exactly how the sources receive this configuration is out of scope for this issue. Suffice it to say that, if there is a configured order, sources can take advantage of this new trait to ensure that order is respected.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Status: Active » Needs review
phenaproxima’s picture

Issue summary: View changes
phenaproxima’s picture

Issue summary: View changes
narendrar’s picture

Status: Needs review » Reviewed & tested by the community

Feedback addressed, moving it to RTBC, Thanks.

tim.plunkett’s picture

Saving credit

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed

Merged !762 🎉

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.