You are here

public function FaqController::categoriesSettings in Frequently Asked Questions 8

Renders the form for the FAQ Settings page - Categories tab.

Return value

The form code inside the $build array.

1 string reference to 'FaqController::categoriesSettings'
faq.routing.yml in ./faq.routing.yml
faq.routing.yml

File

src/Controller/FaqController.php, line 329

Class

FaqController
Controller routines for FAQ routes.

Namespace

Drupal\faq\Controller

Code

public function categoriesSettings() {
  $faq_settings = $this->config
    ->get('faq.settings');
  $build = array();
  $build['#attached']['library'][] = 'faq/faq-scripts';
  $build['#attached']['drupalSettings']['faqSettings']['hide_qa_accordion'] = $faq_settings
    ->get('hide_qa_accordion');
  $build['#attached']['drupalSettings']['faqSettings']['category_hide_qa_accordion'] = $faq_settings
    ->get('category_hide_qa_accordion');
  if (!$this
    ->moduleHandler()
    ->moduleExists('taxonomy')) {
    $this
      ->messenger()
      ->addError(t('Categorization of questions will not work without the "taxonomy" module being enabled.'));
  }
  $build['faq_categories_settings_form'] = $this
    ->formBuilder()
    ->getForm('Drupal\\faq\\Form\\CategoriesForm');
  return $build;
}