This module extends the SiteInformationForm to add a Site API Key. It provides a custom url which returns the JSON response of a page only if Site API Key is provided as a url prameter.
Go to the url <base_url>/page_json/{site_api_key}/{node_id} The site API key can be entered at the URL /admin/config/system/site-information
- lando drupal generate:module // axl_page_json
- lando drupal generate:config:form // Changed the code to extend SiteInformationForm and not ConfigFormBase
- lando drupal generate:routesubscriber // Alter system.site_information_settings route to use Custom SiteInformationForm created in previous step.
- lando drupal generate:controller // PageJsonController::page for route /page_json/{site_api_key}/{node_id}
- Return serialized page or access denied. https://drupal.stackexchange.com/a/191474 --> How to serialize.
- Total time to complete: Around 1 hour