I'm very new to Drupal 10 and I'm having an issue with a custom module I'm trying to create. I have a controller that I'm querying nodes of an FAQ content type that I created. The defined route works when called in the browser. The controller gets called and the query is being made but when I try to theme the output the template is not found. I have a template named "faq-display.html.twig" in my custom/my_theme/templates directory. I've posted my controller code below. I'm sure I have to be missing something simple here but nothing I've tried seems to work.
<?php
namespace Drupal\faq_display\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\node\Entity\Node;
class FaqDisplayController extends ControllerBase {
public function display() {
$query = \Drupal::entityQuery('node')
->accessCheck(FALSE)
->condition('type', 'faq')
->sort('created', 'DESC');
$nids = $query->execute();
$nodes = Node::loadMultiple($nids);
$items = [];
foreach ($nodes as $node) {
$items[] = [
'#theme' => 'node',
'#node' => $node,
];
}
//\Drupal::logger('FAQ')->error(print_r($items, TRUE));
return [
'#theme' => 'faq_display',
'#items' => $items,
];
}
}
I'm sure I'm missing a step somewhere to get this displayed to the browser but my brain is obviously refusing to look at this the right way or ask google the proper question.
Any links or pointers are appreciated.