flarum / issue-archive

0 stars 0 forks source link

Missing ItemList priorities from ExtensionPage sections #34

Open davwheat opened 3 years ago

davwheat commented 3 years ago

Bug Report

Current Behavior Our extension page component is missing priorities from the sections() method, making it difficult to extend.

https://github.com/flarum/core/blob/master/js/src/admin/components/ExtensionPage.js#L94-L117

I'm attempting to extend this method for my own extension's page, while still using the built-in features for settings and permissions as they're pretty convenient.

Workaround:

  sections(): ItemList {
    const old = super.sections();

    old.replace('content', null, 20);
    old.add('customItem', <Component />, 15);
    old.replace('permissions', null, 10);

    return old;
  }

Additional context Technically, this could be "breaking" in the sense of modifying behaviour, depending on how people extend the page, but I think it's worth it for simplicity. The worst that can happen is that things appear out of order, rather than actually breaking functionality.