ByTypeController
in package
Controller for categorizing and displaying nodes by their "Guide Type" taxonomy term.
This controller facilitates the retrieval of nodes based on their associated "Guide Type" taxonomy terms. It then organizes these nodes into groups based on their taxonomy terms, and displays each group in an accordion format, enhancing user navigation and content discoverability on the site.
Table of Contents
Methods
- byType() : array<string|int, mixed>
- Generates a render array to display nodes grouped by their "Guide Type" taxonomy terms in an accordion.
Methods
byType()
Generates a render array to display nodes grouped by their "Guide Type" taxonomy terms in an accordion.
public
byType() : array<string|int, mixed>
This method fetches nodes from the database, categorizes them based on their "Guide Type" taxonomy terms, and prepares them for display. Each node is turned into a clickable link, grouped under its corresponding taxonomy term in the accordion. The method relies on a helper function for database operations and another for constructing the accordion layout.
Tags
Return values
array<string|int, mixed> —A Drupal render array containing the structured accordion. This accordion is built with nodes categorized under their respective "Guide Type" taxonomy terms, facilitating a type-based navigation scheme.