Skip to content

Support inline globals field registration in GlobalsRegistrar #10

@kojiromike

Description

@kojiromike

GlobalsRegistrar currently hardcodes two fields: an enable/disable toggle and an HTML button linking to a separate settings page. This forces modules to build their own settings UI, which creates UX inconsistency — some modules (like sinch-fax, which hand-rolls its own globals registration) show config fields inline in OpenEMR's Admin > Config page, while modules using this library only show a button.

The library should support registering arbitrary config fields inline in the globals section, so modules get the native OpenEMR config experience without reimplementing the registration boilerplate.

Proposed changes

  1. Add field definitions to the descriptor — either extend GlobalsSectionDescriptor or introduce a new type that carries field metadata (label, DATA_TYPE_*, default, description, options for dropdowns).

  2. Have GlobalsRegistrar register them inline — iterate the field definitions and call appendToSection() for each, the same way sinch-fax's Bootstrap::addGlobalSettingsSection() does manually today.

  3. Make the settings-page link optional — only render the "Open Module Settings" button if the module has a separate settings page. Modules that put all config in globals shouldn't show a dead-end link.

Context

sinch-fax currently implements its own GlobalsInitializedEvent listener, ConfigAccessorInterface, GlobalsAccessor, FileConfigAccessor, EnvironmentConfigAccessor, and YamlConfigLoader — ~500 lines of code that duplicate what this library provides. The blocker for migrating it (and for consistent UX across all OCE modules) is that this library doesn't support inline field registration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions