Skip to content

Conversation

@meszarosrob
Copy link
Contributor

@meszarosrob meszarosrob commented Oct 3, 2025

This PR reorders the sections in the plugin details modal to match the WP.org order to resolve #279.

The ordering is applied in two places since plugin information is retrieved in two distinct ways, from what I can see.

The section order differs between api.wordpress.org and api.aspirecloud.net, and while this could be resolved on the AspireCloud side, the default repo domain can be changed, so I chose to "normalize" the returned details.

In the other instance, since no filter is currently available when MetadataDocument is returned, and given the considerable changes planned in #284, I've implemented the ordering at the UI level for now.

I've added basic tests for the ordering, but since there was only a sample test file available, this might not match what you had in mind.

Feel free to modify or close this PR without any problems if it doesn't align with the project direction.

Signed-off-by: meszarosrob <hmm@meszarosrob.com>
Signed-off-by: meszarosrob <hmm@meszarosrob.com>
Signed-off-by: meszarosrob <hmm@meszarosrob.com>
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

Signed-off-by: meszarosrob <hmm@meszarosrob.com>
… namespace

Signed-off-by: meszarosrob <hmm@meszarosrob.com>
Signed-off-by: meszarosrob <hmm@meszarosrob.com>
Signed-off-by: meszarosrob <hmm@meszarosrob.com>
@meszarosrob meszarosrob marked this pull request as ready for review October 4, 2025 14:29
Copy link
Member

@costdev costdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a ton for the PR and the tests @meszarosrob !

I've left a totally optional suggestion as well as some change requests for consistency within the plugin.

Signed-off-by: meszarosrob <hmm@meszarosrob.com>
Signed-off-by: meszarosrob <hmm@meszarosrob.com>
Signed-off-by: meszarosrob <hmm@meszarosrob.com>
Signed-off-by: meszarosrob <hmm@meszarosrob.com>
@meszarosrob meszarosrob requested a review from costdev October 5, 2025 08:00
@Ipstenu
Copy link
Contributor

Ipstenu commented Oct 27, 2025

@costdev Can you please re-review?

@Ipstenu Ipstenu added enhancement New feature or request needs review Probably ready for work, but needs eyes to double check. labels Oct 27, 2025
@Ipstenu Ipstenu added this to the 1.1 milestone Oct 27, 2025
Copy link
Member

@costdev costdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @meszarosrob!

'faq',
'screenshots',
'changelog',
'security',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security is not a standard section and would therefore be grouped in other_notes

Copy link
Contributor Author

@meszarosrob meszarosrob Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not something that is returned/used by WP.org; however, it is defined in the protocol https://github.com/fairpm/fair-protocol/blob/main/specification.md#sections, so I have included it.

My assumption (which might be totally wrong) was that if it's in the protocol, then eventually it might get used.

If somebody passes it today, it will be displayed in the tabs.

@afragen
Copy link
Contributor

afragen commented Oct 29, 2025

There's actually an easier way to accomplish this. It works for both FAIR and dot org.

add_filter('plugins_api_result', 'sort_sections_in_api', 15, 1);
function sort_sections_in_api($result) {
		// Order sections.
		$ordered_sections = array(
		'description',
		'installation',
		'faq',
		'screenshots',
		'changelog',
		'upgrade_notice',
		'other_notes',
	);
	$properly_ordered = array_merge( array_fill_keys( $ordered_sections, '' ), $result->sections );
	$result->sections = array_filter($properly_ordered);

	return $result;
}

Thanks @costdev for the tweaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs review Probably ready for work, but needs eyes to double check.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent plugin details modal section order

4 participants