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.
Issue fork project_browser-3510420
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
Comment #3
phenaproximaComment #4
phenaproximaComment #5
phenaproximaComment #6
narendrarFeedback addressed, moving it to RTBC, Thanks.
Comment #7
tim.plunkettSaving credit
Comment #9
tim.plunkettMerged !762 🎉