You are here

private function FaqController::_renderCategoriesToList in Frequently Asked Questions 8

Renders the output of getIntendedFaqTerms to HTML list.

Parameters

array $items: The structured array made by getIntendedTerms function

string $list_style: List style type: ul or ol.

Return value

string HTML formatted output.

1 call to FaqController::_renderCategoriesToList()
FaqController::faqPage in src/Controller/FaqController.php
Function to display the faq page.

File

src/Controller/FaqController.php, line 558

Class

FaqController
Controller routines for FAQ routes.

Namespace

Drupal\faq\Controller

Code

private function _renderCategoriesToList($items, $list_style) {
  $list = array();
  foreach ($items as $item) {
    $pre = '';
    if (!empty($item['children'])) {
      $pre = $this
        ->_renderCategoriesToList($item['children'], $list_style);
    }
    $list[] = new FormattableMarkup($item['item'] . $pre, []);
  }
  $render = array(
    '#theme' => 'item_list',
    '#items' => $list,
    '#list_style' => $list_style,
  );
  return $this->renderer
    ->render($render);
}