You are here

public function BlockthemeAdminSettingsForm::buildForm in Block Theme 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/BlockthemeAdminSettingsForm.php, line 21
Contains \Drupal\blocktheme\Form\HandbookSearchForm.

Class

BlockthemeAdminSettingsForm
Create form for admin page.

Namespace

Drupal\blocktheme\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('blocktheme.settings');
  $form['blocktheme_themes'] = array(
    '#type' => 'textarea',
    '#default_value' => $config
      ->get('blocktheme_themes'),
    '#title' => t('Custom Block Templates'),
    '#description' => t('Enter one value per row in the form: <em>customtemplate|Friendly Name</em>, where "customtemplate" corresponds to a twig file called <em>block--blocktheme--customtemplate.html.twig</em> as well as to the value of an extra variable <em>blocktheme</em> in the block template.'),
    '#wysiwyg' => FALSE,
  );
  $form['blocktheme_show_custom_block_theme'] = array(
    '#type' => 'checkbox',
    '#default_value' => $config
      ->get('blocktheme_show_custom_block_theme'),
    '#title' => t('Show Custom Block Theme'),
    '#description' => t('Show the custom block theme used for a block in the !block_admin_page.', array(
      '!block_admin_page' => \Drupal::l('block admin page', Url::fromRoute('block.admin_display')),
    )),
  );
  return parent::buildForm($form, $form_state);
}