You are here

public function NewRelicRpmDeploy::buildForm in New Relic 2.x

Same name and namespace in other branches
  1. 8 src/Form/NewRelicRpmDeploy.php \Drupal\new_relic_rpm\Form\NewRelicRpmDeploy::buildForm()
  2. 2.0.x src/Form/NewRelicRpmDeploy.php \Drupal\new_relic_rpm\Form\NewRelicRpmDeploy::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 FormInterface::buildForm

File

src/Form/NewRelicRpmDeploy.php, line 51

Class

NewRelicRpmDeploy
Provides a form to allow marking deployments on the New Relic interface.

Namespace

Drupal\new_relic_rpm\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = [];
  $form['revision'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Revision'),
    '#required' => TRUE,
    '#description' => $this
      ->t('Add a revision number to this deployment.'),
  ];
  $form['description'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Description'),
    '#description' => $this
      ->t('Provide some notes and description regarding this deployment.'),
  ];
  $form['user'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('User'),
    '#default_value' => $this
      ->currentUser()
      ->getAccountName(),
    '#description' => $this
      ->t('Enter the name for this deployment of your application. This will be the name shown in your list of deployments on the New Relic website.'),
  ];
  $form['changelog'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Changelog'),
    '#description' => $this
      ->t('Provide a specific changelog for this deployment.'),
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Create Deployment'),
  ];
  return $form;
}