Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlotFill sorting with a priority property #16384

Open
wants to merge 8 commits into
base: master
from

Conversation

@ryanwelcher
Copy link
Contributor

commented Jul 2, 2019

Description

As is stands now, there is no way to control the order of the items being rendered in Slots. This PR adds a new priority property to the settings object that is passed to registerPlugin. This property is optional and has a default value of 10. I chose 10 as that is the default priority for Hooks and familiar to most WordPress developers and so that we can move items ahead of the default position without using negative numbers.

The approach adds the priority property when the plugin is being registered and then uses sortBy to sort the plugins before they are rendered inside the <PluginArea /> component.

How has this been tested?

This has been tested locally and using the unit and e2e tests.

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
@ryanwelcher

This comment has been minimized.

Copy link
Contributor Author

commented Jul 2, 2019

This was broken out based on comments from @youknowriad on #13361

@ryanwelcher

This comment has been minimized.

Copy link
Contributor Author

commented Aug 26, 2019

@youknowriad have you had a chance to think on this any further? Happy to make any changes as needed.

@ryanwelcher ryanwelcher requested review from nicolad and swissspidy Aug 27, 2019

@ryanwelcher ryanwelcher force-pushed the ryanwelcher:try/slot-fill-priority branch from be7bf0d to 31be67b Sep 6, 2019

@ryanwelcher ryanwelcher force-pushed the ryanwelcher:try/slot-fill-priority branch from 31be67b to 247a1a2 Sep 6, 2019

@paaljoachim

This comment has been minimized.

Copy link

commented Sep 11, 2019

Adding in what @youknowriad mentioned during the core editor meeting on the 11th September:
"To be honest, I'm not entirely sold on this because it's very tied to the implementation of the Slot. (not a fully semantic API).
I don't have a better alternative at the moment.
I know @matias have some thoughts about that as well."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.