ItemList API improvements
Open
@davwheat is already working on this.
Since Aug 18, 2021.
org/keep
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Feature Request
Is your feature request related to a problem? Please describe.
ItemList currently serves as an ordered associative structure, with order determined by integer "positions". It would be convenient and more self-documenting if items could be inserted relative to other items. For instance:
- items.after('delete').add('something', hello)
- items.before('delete').add('something', hello)
- items.after('delete', 10).add() // specify a fallback priority
- items.after(['foo', 'bar'], 10).add() // specify multiple items to add after
Initially proposed in https://github.com/flarum/core/issues/1317
Describe the solution you'd like
We'd need to include a modified topological sort (like https://github.com/flarum/core/pull/2317), that also includes support for integer-based priority.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.