You are here

public function AdminForm::buildForm in Form Defaults 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 FormInterface::buildForm

File

src/Form/AdminForm.php, line 13

Class

AdminForm

Namespace

Drupal\Formdefaults\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['instructions'] = array(
    '#type' => 'markup',
    '#markup' => '<p>To alter the default labels and text descriptions associated with a form, enable the form ' . 'defaults editor below. Navigate to the form you wish to modify and click the [edit] link on ' . 'the field you want to edit. You\'ll be allowed to edit field titles and markup fields ' . '(like this one), as well as the textual descriptions for each field. It\'s also possible to ' . 'add form elements and hide those already present.</p>' . '<p>Use the controls above to manage those forms you\'ve modified.</p>',
  );
  if (@$_SESSION['formdefaults_enabled']) {
    $form['disable'] = array(
      '#type' => 'submit',
      '#value' => 'disable',
    );
  }
  else {
    $form['enable'] = array(
      '#type' => 'submit',
      '#value' => 'enable',
    );
  }
  return $form;
}