You are here

public function SettingsForm::buildForm in Simple Google Custom Search Engine 8

Same name and namespace in other branches
  1. 2.0.x src/Form/SettingsForm.php \Drupal\simple_gse_search\Form\SettingsForm::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/SettingsForm.php, line 30

Class

SettingsForm
Defines a settings form for administering Simple CSE search.

Namespace

Drupal\simple_gse_search\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('simple_gse_search.settings');
  $form['cx'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Google Custom Search Engine ID'),
    '#description' => $this
      ->t('Get your custom search engine ID from <a href=":url" target="_blank">https://www.google.com/cse</a>.', [
      ':url' => 'https://www.google.com/cse',
    ]),
    '#default_value' => $config
      ->get('cx'),
  );
  return parent::buildForm($form, $form_state);
}