Skip to content

Wrapper Bridge Pattern

R41z0r edited this page Jun 13, 2026 · 1 revision

Contents

Addons can expose their own SettingsCreate* helpers and keep feature modules away from raw LibSettingsDesigner calls. The helper layer can register legacy settings metadata, modern page metadata, defaults, locale text, and runtime callbacks from one call.

local L = LibStub("AceLocale-3.0"):GetLocale(addonName)

local section = addon.SettingsCreateExpandableSection(category, {
  name = L["myFeature"],
  description = L["myFeatureDesc"],
  configPageID = "interface.my-feature",
  iconKey = "settingspage",
  newTagID = "MyFeature",
  expanded = false,
  colorizeTitle = false,
})

The helper can internally call:

app:RegisterLegacySection(section, {
  categoryID = "interface",
  pageID = data.configPageID,
  title = data.name,
  description = data.description,
  iconKey = data.iconKey,
  newTagID = data.newTagID,
})
addon.SettingsCreateCheckbox(category, {
  var = "myFeatureEnabled",
  text = L["myFeatureEnabled"],
  desc = L["myFeatureEnabledDesc"],
  default = false,
  parentSection = section,
  func = function(value)
    addon.db.myFeatureEnabled = value == true
    addon.RefreshMyFeature()
  end,
})

The helper can internally call:

app:RegisterLegacyControl({
  parentSection = data.parentSection,
  id = data.id or data.var,
  key = data.var,
  type = "toggle",
  label = data.text,
  description = data.desc,
  default = data.default,
  setValue = data.func,
})
  • Keep wrapper helpers thin and predictable.
  • Feature modules should use the wrapper layer when one exists.
  • Keep user-facing strings in the host addon's locale system.
  • Keep setters focused on persistence and runtime refresh.
  • Do not rebuild open dropdown or MultiDropdown menus from selection callbacks.

Wiki
  • Home
  • Architecture
  • Vendoring
  • Quick Start
  • Field Glossary
  • Troubleshooting
  • Validation

Reference
  ⚬ Config API
  ⚬ UI API
  ⚬ Elements
  ⚬ Examples

Elements
  Structure
   • Category
   • Page
   • Group
   • Dashboard
   • InfoPage
   • Custom
  Controls
   • Toggle
   • CheckboxDropdown
   • Dropdown
   • MultiDropdown
   • SoundDropdown
   • Input
   • Slider
   • Button
  Advanced
   • ColorPicker
   • ColorPalette
   • ColorOverrides
   • ReorderList
   • Expandable
   • Notes

Examples
  Start
   • Minimal Addon
   • Complete Settings Center
   • Wrapper Bridge Pattern
  Data and Behavior
   • Dependent Controls
   • Nested Database Values
   • Dynamic Dropdowns
   • Runtime Refresh
   • Search and New Badges
   • Custom Hosted Editors
  Polish
   • Support Links
   • Theme Colors
   • Theme Borders

Clone this wiki locally