You are here

public function HubspotSettingsForm::buildForm in Hubspot forms 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/HubspotSettingsForm.php, line 51

Class

HubspotSettingsForm
Configure site information settings for this site.

Namespace

Drupal\hubspot_forms\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = \Drupal::config('hubspot_forms.settings');
  $form['hubspot_api_key'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Hubspot API Key'),
    '#default_value' => $config
      ->get('hubspot_api_key'),
    '#description' => $this
      ->t('Please use <strong>demo</strong> to load example forms.
        Generate a <a href="https://app.hubspot.com/keys/get" target="_blank">new key</a>.
        Make sure to clear Drupal cache after you change API Key.'),
    '#required' => TRUE,
  ];
  return parent::buildForm($form, $form_state);
}