You are here

public function CredentialForm::buildForm in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/Form/CredentialForm.php \Drupal\acquia_connector\Form\CredentialForm::buildForm()
  2. 3.x src/Form/CredentialForm.php \Drupal\acquia_connector\Form\CredentialForm::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/CredentialForm.php, line 67

Class

CredentialForm
Form for Acquia Credentials.

Namespace

Drupal\acquia_connector\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $storage = new Storage();
  $form['#prefix'] = $this
    ->t('Enter your product keys from your <a href=":net">application overview</a> or <a href=":url">log in</a> to connect your site to Acquia Insight.', [
    ':net' => Url::fromUri('https://cloud.acquia.com')
      ->getUri(),
    ':url' => Url::fromRoute('acquia_connector.setup')
      ->toString(),
  ]);
  $form['acquia_identifier'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Identifier'),
    '#default_value' => $storage
      ->getIdentifier(),
    '#required' => TRUE,
  ];
  $form['acquia_key'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Network key'),
    '#default_value' => $storage
      ->getKey(),
    '#required' => TRUE,
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Connect'),
  ];
  $form['actions']['signup'] = [
    '#markup' => $this
      ->t('Need a subscription? <a href=":url">Get one</a>.', [
      ':url' => Url::fromUri('https://www.acquia.com/acquia-cloud-free')
        ->getUri(),
    ]),
  ];
  return $form;
}