You are here

public function AdsTxtAdminSettingsForm::buildForm in AdsTxt 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/AdsTxtAdminSettingsForm.php, line 30

Class

AdsTxtAdminSettingsForm
Configure adstxt settings for this site.

Namespace

Drupal\adstxt\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('adstxt.settings');
  $form['adstxt_content'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Contents of ads.txt'),
    '#default_value' => $config
      ->get('content'),
    '#cols' => 60,
    '#rows' => 20,
  ];
  $form['app_adstxt_content'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Contents of app-ads.txt'),
    '#default_value' => $config
      ->get('app_content'),
    '#cols' => 60,
    '#rows' => 20,
  ];
  return parent::buildForm($form, $form_state);
}