Skip to content

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

  1. Create a module settings page that lists configuration variables for this module.

  2. Create a new configuration variable called something like important_node

  3. Add an input to the settings/configuration page. Use the entity_reference field type to let user select node.

  4. Use new controller to pull configuration variable and load the node, rendering it using a render array.

How to

  1. As an administrator, navigate to the module settings page and select a node.

  2. 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

Merge request reports