You are here

public function SimpleAdSenseForm::buildForm in Simple AdSense 1.0.x

Same name and namespace in other branches
  1. 8.0 src/Form/SimpleAdSenseForm.php \Drupal\simple_adsense\Form\SimpleAdSenseForm::buildForm()

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/SimpleAdSenseForm.php, line 34

Class

SimpleAdSenseForm
Class SimpleAdSenseForm.

Namespace

Drupal\simple_adsense\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('simple_adsense.settings');
  $form['publisher_id'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Simple AdSense Publisher ID'),
    '#description' => $this
      ->t('Google AdSense Publisher Id. eg: pub-9513614146655499'),
    '#maxlength' => 64,
    '#size' => 64,
    '#default_value' => $config
      ->get('publisher_id') ? $config
      ->get('publisher_id') : 'pub-9513614146655499',
  );
  return parent::buildForm($form, $form_state);
}