/admin/settings/..., render a form with the core layout, and let Aikeedo’s settings component save the values as options.
The page
src/RequestHandlers/SettingsRequestHandler.php
AbstractAdminViewRequestHandler puts the route under /admin and applies the admin middleware, so non-administrators never reach it.
The template
templates/settings.twig
What each piece does
How values are stored
submit() posts the form to /admin/api/options. Each top-level field name becomes one option key, and the nested values become its JSON payload:
Saving merges your fields into the existing option, so you can split settings across several pages without wiping the other page’s values.
Reading values back
option:
Checkboxes submit
1 or 0, which is cast to a boolean when injected. An option nobody saved yet resolves to null, so always provide defaults.Writing values from PHP
Link the page from the admin panel
Add a navigation item inboot() so administrators can find the page, and set extra.default_url in your manifest so the plugins list links to it:
Extension points that the core lists for administrators follow a URL convention: the key you register the implementation under becomes the settings URL, such as
/admin/settings/payments/{key}, /admin/settings/tax-engines/{key}, /admin/settings/cdn/{key} and /admin/settings/vector-databases/{key}. Declare a route at that exact path, and point default_url at it.Handling secrets
- Use
type="password"withautocomplete="new-password". - Never echo a secret into JavaScript or a data attribute.
- Show connection state, such as “key configured”, rather than the value itself, where you can.
Test and live credentials
A common pattern is onemode select plus two credential sets, with hidden inputs mirroring the selected set into the flat keys your PHP reads:
option.hello.api_key and doesn’t care which mode is active.
Multi-page settings
For a larger integration, split the pages and redirect until setup is complete:{% set active_menu = '/admin/plugins' %} on those templates so the sidebar highlights Plugins.
Troubleshooting
Saving does nothing, and no toast appears
Saving does nothing, and no toast appears
The form is missing
x-ref="form" or @submit.prevent="submit", or xdata isn’t set to settings.The value is saved but the page shows the old one
The value is saved but the page shows the old one
Options are injected when the handler is constructed. Reload the page. If it still shows stale data, clear the cache.