public function GeneralForm::buildForm in Frequently Asked Questions 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ GeneralForm.php, line 30
Class
- GeneralForm
- Form for the FAQ settings page - general tab.
Namespace
Drupal\faq\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$faq_settings = $this
->config('faq.settings');
$form['faq_title'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Title'),
'#default_value' => $faq_settings
->get('title'),
);
$form['body_filter']['faq_description'] = array(
'#type' => 'textarea',
'#title' => $this
->t('FAQ Description'),
'#default_value' => $faq_settings
->get('description'),
'#description' => $this
->t('Your FAQ description. This will be placed at the top of the page, above the questions and can serve as an introductory text.'),
'#rows' => 5,
);
$form['faq_custom_breadcrumbs'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Create custom breadcrumbs for the FAQ'),
'#description' => $this
->t('This option set the breadcrumb path to "%home > %faqtitle > category trail".', array(
'%home' => $this
->t('Home'),
'%faqtitle' => $faq_settings
->get('title'),
)),
'#default_value' => $faq_settings
->get('custom_breadcrumbs'),
);
return parent::buildForm($form, $form_state);
}