AllGuidesController
extends ControllerBase
in package
Defines a controller for the LGMS Module.
This controller is responsible for returning responses for specific routes defined in the LGMS module. Primarily, it handles the display of all guides by rendering a view and providing additional functionality based on user authentication.
Table of Contents
Methods
- allGuides() : array<string|int, mixed>
- Renders a list of all guides using a Drupal view and adds a search bar and dashboard link for authenticated users.
Methods
allGuides()
Renders a list of all guides using a Drupal view and adds a search bar and dashboard link for authenticated users.
public
allGuides() : array<string|int, mixed>
The method constructs a render array with the following:
- A Drupal view displaying all guides.
- A search bar that is shown to all users.
- A "My Dashboard" link that is only shown to authenticated users.
It leverages the LGMS module's library for styling and utilizes the Views module to fetch and display the guides. Permissions are checked to conditionally display contextual links for users with the 'administer views' permission and to differentiate the content for authenticated versus anonymous users.
Return values
array<string|int, mixed> —A render array for Drupal to render the all guides page. It includes the view for all guides, possibly a search bar, and a dashboard link for authenticated users.