Problem/Motivation

Server-readable editor preferences (hotkeys, media file associations, tool toggles) are stored per-account on the user's navigation_plus_settings map field, but each new preference needed its own bespoke save route and controller. There was no single read/write API, which made adding a preference more work than it should be.

Proposed resolution

  • Add an EditorSettings service exposing get($namespace, $key, $default) and set($namespace, $key, $value), namespaced by the owning module and persisted on the live user entity (outside any workspace).
  • Add a generic /navigation-plus/setting/{namespace}/{key}/{value} route to Settings::saveSetting(), which calls EditorSettings::set().
  • Add a Drupal.NavigationPlus.saveSetting(namespace, key, value) JS helper as the client counterpart.

Purely visual, client-only toggles (block preview, layout outlines) remain in the browser's localStorage and are intentionally not handled
here.

API changes

  • New navigation_plus.editor_settings service (EditorSettings).
  • New route navigation_plus.settings.save_setting.
  • New JS helper Drupal.NavigationPlus.saveSetting().

Comments

tim bozeman created an issue. See original summary.

  • tim bozeman committed 6d6baaaf on 2.3.x
    task: #3594967 Add a per-user editor settings service for server-...
tim bozeman’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.