WIP: Create module settings page that accepts node input to render to specific page
Purpose
Our exercise has us building a controller that loads an administrator-controlled node when a certain path is used. We want the administrator to be able to select a node to be rendered on the path /thunderdome using twig.
Approach
-
Create a module settings page that lists configuration variables for this module.
-
Create a new configuration variable called something like important_node
-
Add an input to the settings/configuration page. Use the entity_reference field type to let user select node.
-
Use new controller to pull configuration variable and load the node, rendering it using a render array.
How to
-
As an administrator, navigate to the module settings page and select a node.
-
As a user (anonymous or admin), navigate to /thunderdome and see the node get rendered.
Review Checklist
-
Sufficient documentation (can others figure out what's going on without context? -
Sufficient test coverage. -
All pipelines pass. -
Added applicable files to code standards and automated test pipelines. -
No merge conflicts present. -
Merge request follows deployment requirements.
Edited by Colby Chiste