• Dev
  • Flamarkt Backoffice

This is the official discussion for the flamarkt/backoffice package.

It's implemented as an extension for technical reasons, but it's really meant to be used as a library.

This package is a root requirement of most Flamarkt extensions, but it has applications outside of Flamarkt as well.

More documentation will be provided in the future, but here's a summary of the most important features provided by this package:

Frontend

A new Flarum frontend called backoffice which can be accessed by anyone with the backoffice permission.

The frontend is based on the admin frontend of Flarum, but extensions don't automatically run on it. Extensions must register a javascript and/or CSS file through the Extend\Frontend extender of Flarum.

New composer.json parameters:

  • extra.flamarkt-backoffice.settingsInBackoffice: whether to redirect admin to backoffice for settings
  • extra.flamarkt-backoffice.showInBackoffice: whether to show extension in the extension list of backoffice
  • extra.flamarkt-backoffice.hideFromAdmin: whether to hide extension from admin list of extensions

Some of the classes must be imported through the backoffice exports, including flamarkt/backoffice/backoffice/app, flamarkt/backoffice/backoffice/components/BackofficeNav, etc.

The exports from Flamarkt extensions are not automatically available. You must update your webpack.config.js to use them, here's an example https://github.com/flamarkt/taxonomies/blob/main/js/webpack.config.js

Even if you are not importing Flamarkt classes, you still need to modify the entry configuration in webpack.config.js to add backoffice.js to the list of frontends to build.

Flarum patches

The package contains fixes to Flarum bugs that are necessary for Flamarkt and its extensions.

Re-usable classes

The package exports re-usable classes that are used in multiple Flamarkt extensions.

Non-exhaustive list:

  • KeyboardNavigatable: same as Flarum core but in the common namespace.
  • AbstractRelationshipSelect and UserRelationshipSelect: a re-usable select input for model relationships.
  • AbstractListState: an alternative to Flarum's PaginatedListState.
  • ActiveLinkButton: alternative to Flarum's LinkButton with ability to configure which routes will make the button active state.

Typescript typings are available for all exported classes. See https://github.com/flamarkt/taxonomies/blob/main/js/tsconfig.json for an example to load the typings.

Optional migrations

Allows a new callback function with key when in migration definition. This callback will be called when migrating up, and the migration will be skipped if the result is falsy. The migration will attempt to run again the next time the extension is enabled or php flarum migrate is run.

All migrations always run down (but the migration won't be in the run down list if it never successfully migrated up).


This package will follow Flamarkt's beta cycle. Semver will be respected, with changes that aren't backward-compatible only introduced in major versions. But a new major version might be released pretty quickly depending on the Flamarkt development progress. Current version is 0.1.1. Once Flamarkt reaches the end of the first beta cycle, a new 0.2 breaking version will be released for all Flamarkt projects including this one.

I recommend you use a ^ constraint on this dependency in your extension, but keep in mind this will require an update when the Flamarkt 0.2 cycle starts otherwise your extension will become incompatible with Flamarkt.

Let me know if you have any question or suggestion!

17 days later

Just a quick question, since this post is under Dev tag not extension tag. I guess this cannot be installed on flarum at the moment, right?

If so, it also lead to another question, I just installed Taxonomies, and it needs to installed "Backoffice" first, so I guess, until the release of the Backoffice, I won't be able to use Taxonomies, right?

    ash3T it can be installed.

    I used the dev tag because it's a "utility" extension and it doesn't make sense for people to install it on its own. Like I said in the README if I could have made this package as just a library and not an extension I would have, but it has to be an extension for technical reasons. Otherwise it's very similar to by Local Extenders or Pages Generator packages.

    When you install Taxonomies, this extension will automatically be installed. I recommend not adding Backoffice as an explicit Flarum dependency. Just let Composer download the correct version of Backoffice automatically.

    Officially this package is in beta, but it will still get the same level of support as all my actively supported extensions.

      clarkwinkelmann

      clarkwinkelmann When you install Taxonomies, this extension will automatically be installed.

      Thanks for the explanation. Can you please tell me how to enable Backoffice? Assuming that backoffice is automatically installed when I installed Taxonomies.

        ash3T you should see it listed as an extension in Flarum admin panel. It's just called "Backoffice" and has a green icon.

        The output of the composer require flamarkt/taxonomies installation command should list that both taxonomies and backoffice have been installed.

        If Backoffice is not in the list, you could try to remove and re-add taxonomies with composer remove flamarkt/taxonomies and then composer require flamarkt/taxonomies again and see if the Composer output correctly shows both packages being installed.

          clarkwinkelmann you should see it listed as an extension in Flarum admin panel. It's just called "Backoffice" and has a green icon.

          Right. My bad. I should have checked it.

          Is there any flarum site who run Taxonomies, that I may take a look?

            ash3T not my website, but I know this website uses user taxonomies on public profiles https://community.skillsnet.swiss/

            Taxonomies will also soon be visible on the Flamarkt demo platform on product pages.

            I can't think of any publicly available website that uses taxonomies for discussions at this time.

              5 months later

              I just installed the backoffice in a new setup, and when I access the backoffice for the first time it showed the no-js view, as I have very few third party extensions I have randomly disabled extensions and it seems that the problem is related to FoF Night Mode.

              Edit: I've tried now with an old site where I used the taxonomies since a few months ago and now the backoffice doesn't work either, also because of FoF Night Mode, I suspect it's because of one of the last updates of this extension.

                Darkle I can confirm, there's an issue when Nightmode is enabled.

                Interestingly but not unexpectedly, it's not a javascript error. In fact javascript works perfectly fine. It's just the CSS that is entirely missing from the Backoffice. You can still perform most actions, the UI will just be absolutely horrible without any styling.

                I opened an issue to track this but I currently don't have much time to investigate flamarkt/backoffice1

                Nightmode has always been a big mess with the way it overrides the assets compiler. I believe it's still incompatible with my Wordpress extension as well, which also uses custom Flarum frontends.

                  clarkwinkelmann Oh that's right, looking it over I automatically thought it was the no-js view but as you say it's not, it's functional, if I see anything related I'll post it in the issue, for now I think it only causes that with the backoffice, so disabling Nightmode momentarily to work in the backoffice is a viable option until there's a fix.

                  2 months later

                  I just install backoffice with Composer and can't use it. Got this message

                  This special admin panel gives extensions a new place for moderation tools.
                  It's still a work in progress. This space will accept widgets just like Flarum's admin in a future version.

                  I use Flarum version 1.6.1 is there anyways to use Flamarkt here

                    nguyenplayground this extension only provides an empty admin panel for other extensions to use.

                    Flamarkt is not ready to be tested yet. The code is on GitHub for people with the requisite developer knowledge, but there won't be any guide available until the first version is ready.

                      Version 0.1.3

                      • Improved focus handling on relationship select. Suggestions now only show once and then require interacting with the input to appear again. On mobile focus is no longer automatically put back on the input after selecting an option via touch.
                      • Fixed user relationship select spinning forever when search term contains uppercase characters.
                      a year later

                      In the Composer.json test file there is no line flamarkt/backoffice << in the admin page there is a Backoffice entry

                      Please tell me how to delete the Backoffice extension

                        Litalino other extensions use this as a dependency. Likely the taxonomies extension. composer why flamarkt/backoffice can help you figure it out.

                        @clarkwinkelmann

                        I reinstalled backoffice and taxonomies

                        Composer is displayed

                        "flamarkt/backoffice": "0.1.3",
                        "flamarkt/taxonomies": "0.1.9",

                        I enable backoffice. In the backoffice settings, I enable additional taxonomies and get an error

                        POST https://flarum.khatvongsong.vn/api/extensions/flamarkt-taxonomies 500 (Internal Server Error)
                        (anonymous) @ request.js:173
                        (anonymous) @ request.js:23
                        (anonymous) @ request.js:22
                        e.request @ Application.tsx:518
                        n.toggle @ ExtensionPage.tsx:228
                        n.onchange @ Checkbox.tsx:59
                        (anonymous) @ withAttr.ts:14
                        j.handleEvent @ render.js:888
                        flamarkt-taxonomies:1 
                        
                        
                        Uncaught (in promise) mr {status: 500, options: {…}, xhr: XMLHttpRequest, responseText: '{"errors":[{"status":"500","code":"unknown"}]}', response: {…}, â€¦}alert: {type: 'error', content: Array(1), controls: false}options: {background: true, url: 'https://flarum.khatvongsong.vn/api/extensions/flamarkt-taxonomies', method: 'POST', body: {…}, deserialize: Æ’, â€¦}response: {errors: Array(1)}responseText: "{\"errors\":[{\"status\":\"500\",\"code\":\"unknown\"}]}"status: 500xhr: XMLHttpRequest {readyState: 4, timeout: 0, withCredentials: false, abort: Æ’, onreadystatechange: Æ’, â€¦}[[Prototype]]: Object
                        Promise.then (async)
                        n.toggle @ ExtensionPage.tsx:235
                        n.onchange @ Checkbox.tsx:59
                        (anonymous) @ withAttr.ts:14
                        j.handleEvent @ render.js:888

                        Finally, taxonomies are not enabled in backoffice settings

                          Litalino anything in the Flarum error log or when enabling debug mode and trying again? See https://docs.flarum.org/troubleshoot

                          If you need further help, please post in the Taxonomies extension discussion as the problem seems to be with Taxonomies and not Backoffice https://discuss.flarum.org/d/30499-flamarkt-taxonomies

                          In fact Backoffice has no database tables/columns at all so there should be no way for an error to happen when enabling Backoffice.

                            clarkwinkelmann
                            I get an error:

                             Next Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'flamarkt_discussion_taxonomy_term' already exists in /home/flarum.khatvongsong.vn/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18
                            ...

                            https://discuss.flarum.org/d/30499-flamarkt-taxonomies/44