Codex and settings discovery

Summary

mam_codex_manager (includes/app-settings/codex-manager.php) is a tooling-side settings discovery API. It walks the registered content classes, their settings categories, and their per-field schemas, producing a structured catalog that admin tooling can consume — for example, an admin-side documentation generator, a settings-search UI, or an API for external editors.

It is not user-facing. End-users never see codex output directly.


Public surface

Method Returns
mam_codex_manager::get_all_settings() Array of every registered setting across all content classes
mam_codex_manager::get_categories() List of unique settings categories with their slugs
mam_codex_manager::get_for_content_class( $class ) Settings declared by a specific content class
mam_codex_manager::get_for_category( $slug ) Settings in a specific category

Output shape mirrors what app_settings() returns from each content class:

array(
    array(
        'category'    => 'login',
        'title'       => 'Require Login?',
        'variable'    => 'require_login',
        'type'        => 'yes-no',
        'id'          => 'tsl-require_login',
        'environment' => 'global',
        // augmented fields:
        'content_class' => 'local_app_login_button',
        'help_desc'     => '... (from mam_settings_set_help_desc filter)',
    ),
    ...
)

Hook involved

Hook Type Role
do_action('mam_codex_update_settings', $settings) Action Fires when codex catalog is rebuilt
mam_settings_set_help_desc Filter Sibling plugins inject help-text descriptions per setting

When to use it

  • Building an admin search UI — let admins search “what setting controls the geofilter radius?”
  • Auto-generating docs — produce a Markdown / HTML reference of every setting from source
  • External integrations — an external editor that needs to know what settings exist
  • Refactor diagnostics — enumerate settings to find orphans

When NOT to use it

  • In the phone-data hot path. get_all_settings() walks every content class; it’s expensive. Cache the result aggressively if you call it from a request-time path.
  • For per-request setting reads. Use mam_app_settings_get_setting for those.
  • For determining “does this setting exist?” at runtime. Use metadata_exists() or check the option directly — codex is for tooling, not gating.

Gotchas

  • Codex catalog is rebuilt on demand. It enumerates the global $local_app_content registry plus walks each class’s app_settings() method. Heavy.
  • Content classes that omit app_settings() appear in the catalog but contribute no entries.
  • mam_codex_update_settings action is fired by codex itself when the catalog is built — sibling plugins listening here can mirror the catalog into their own indexes.
  • Help descriptions are lazy — they require a mam_settings_set_help_desc subscriber to populate. Without one, the help_desc field is empty.

  • Settings cascade overview
  • Content classes overview
  • Hook: mam_app_settings_get_setting

Metadata

Field Value
Article type Plugin Overview
Plugin slug mam-main
Applies to plugin version 2.1.11+
Category App Settings Reference
Audience PHP developer
Last verified 2026-05-02
Contents

    Need Support?

    Can’t find the answer you’re looking for? Don’t worry we’re here to help!