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
-
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).
-
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.
-
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.
GlobalsRegistrarcurrently 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
Add field definitions to the descriptor — either extend
GlobalsSectionDescriptoror introduce a new type that carries field metadata (label,DATA_TYPE_*, default, description, options for dropdowns).Have
GlobalsRegistrarregister them inline — iterate the field definitions and callappendToSection()for each, the same way sinch-fax'sBootstrap::addGlobalSettingsSection()does manually today.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
GlobalsInitializedEventlistener,ConfigAccessorInterface,GlobalsAccessor,FileConfigAccessor,EnvironmentConfigAccessor, andYamlConfigLoader— ~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.