Problem/Motivation The module currently alters the robotstxt admin form and stores a custom key in robotstxt.settings (robotstxt_content_for_domain_app). This creates a hidden dependency on the Robotstxt module, mixes ownership of configuration, complicates permissions/export, and makes UX less clear. There are no tests for this behavior.
Proposed resolution
•
Add a dedicated ConfigFormBase at /admin/seo/robots (under MyREST SEO menu) with two textareas:
i)
Extra robots.txt directives for the main site.
ii)
Extra robots.txt directives for the “domain_app” host (if used).
•
Store these values in myrest_seo.settings (config schema provided).
•
Add hook_update_N() to migrate existing value from robotstxt.settings:robotstxt_content_for_domain_app to myrest_seo.settings. Keep a BC read fallback (if old value exists and new is empty) for one minor release and log a deprecation message once per cache clear.
•
Keep a link to the original Robotstxt module page for convenience; do not alter its form anymore.
•
Permissions: reuse ‘administer myrest_seo’ for the new form.
•
Tests: Kernel test for the update path (migration) and Functional test to ensure the new form loads, saves, and exports config.
•
Docs: update README.md with the new path, config names, and migration note.
Alternatives considered
•
Keep FormAlter + current schema in robotstxt.settings: rejected because it mixes config ownership and couples to another module’s UI.
Tasks
•
[ ] Implement ConfigFormBase: src/Form/RobotsSettingsForm.php, route at /admin/seo/robots, menu link, permission.
•
[ ] Add config schema for myrest_seo.settings (two keys: robots_extra_main, robots_extra_domain_app).
[ ] hook_update_N(): migrate robotstxt.settings.robotstxt_content_for_domain_app to myrest_seo.settings. Add deprecation message and BC read fallback.
•
[ ] Remove FormAlter and its submit handler; keep a graceful no-op if Robotstxt module is absent.
•
[ ] Update README.md (new path, config names, migration).
•
[ ] Kernel test for migration; Functional test for form load/save.
•
[ ] Ensure CI green (PHPCS, phpstan-drupal, PHPUnit).
Acceptance criteria
•
New config form available at /admin/seo/robots, protected by ‘administer myrest_seo’.
•
Values persist in myrest_seo.settings and are exportable.
•
Update path migrates existing data from robotstxt.settings; no fatal errors if Robotstxt module is not installed.
•
PHPCS and phpstan-drupal pass; tests are green on drupal.org CI.
Risk/BC
•
Low. The behavior is moved, not removed; a deprecation and BC read fallback cover existing sites. Clear release notes are required.
Testing instructions
1)
Install module, ensure /admin/seo/robots loads and saves values.
2)
Create a site state with robotstxt.settings.robotstxt_content_for_domain_app set. Run database updates. Confirm values are migrated to myrest_seo.settings and no longer required in robotstxt.settings.
3)
Export config; confirm keys exist under myrest_seo.settings.
Issue fork myrest_seo-3567247
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
sergeydruua commented