Skip to content

Settings: YAML-based config pages#40

Open
titus-toia wants to merge 2 commits into
mainfrom
settings-api
Open

Settings: YAML-based config pages#40
titus-toia wants to merge 2 commits into
mainfrom
settings-api

Conversation

@titus-toia
Copy link
Copy Markdown

What

Integrates the YAML-based settings/config-pages feature, rebased onto current main.

Lets a plugin register a full settings page from a YAML file:

tangible_object_register_settings( $plugin, __DIR__ . '/config/settings.yaml' );

Adds:

  • src/Settings/YamlSettingsLoader.php — parses the YAML and builds a singular DataView (tabs, sections, fields).
  • src/Settings/SettingsRenderer.php — renders the page in the framework's settings layout (tabs/nav, form-table fields, submit).
  • src/Settings/YamlFieldMapper.php — maps YAML field types → DataView + Tangible Fields config.
  • src/Settings/index.php — global tangible_object_register_settings() entry point (registered via composer files autoload).
  • composer — adds symfony/yaml ^7.0.
  • RequestRouter::extract_post_data() — reads nested $_POST[settings_slug][field] first (settings/singular mode), falling back to flat POST.

Rebase note

This was previously on settings-api, ~3.5 months stale (last touched 2026-02-16) and 13 commits behind main. Rebased onto current main (which includes the late-May RequestRouter / POST-forms / nonce refactor, #34–38). Two commits, replayed cleanly:

  • yaml based config
  • Fix settings save: extract nested POST data from settings key

The only main-overlapping change is extract_post_data(), which still targets a method present post-refactor and applied without conflict. The new Settings/* files are clean additions.

Testing

PHP lint passes on all rebased files. The WP integration test suite (tests/phpunit) requires a wordpress-develop harness not available locally — relying on CI to validate against the refactor.

titustangible and others added 2 commits May 30, 2026 19:47
The SettingsRenderer nests field names under the settings slug
(e.g., settings_slug[field_name]), but extract_post_data() was
looking for flat $_POST[field_name]. Values were silently skipped
on every save, resulting in empty settings.

Check $_POST[slug][field_name] first, fall back to flat for compat.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants