You are here

public function SupportTicketEntitySettingsForm::buildForm in Support Ticketing System 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

modules/support_ticket/src/Form/SupportTicketEntitySettingsForm.php, line 65
Contains \Drupal\config\Form\SupportTicketEntitySettingsForm.

Class

SupportTicketEntitySettingsForm
Defines the settings form for a support ticket entity.

Namespace

Drupal\support_ticket\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = array();
  $config = $this
    ->config('diff.settings');
  $form['info'] = array(
    '#markup' => 'Select which of the below base fields of support ticket entities should be compared.',
  );
  $support_ticket_base_fields = $this->entityManager
    ->getBaseFieldDefinitions('support_ticket');
  foreach ($support_ticket_base_fields as $field_key => $field) {
    $form[$field_key] = array(
      '#title' => $this
        ->t('@field_label (%field_type)', array(
        '@field_label' => $field
          ->getLabel(),
        '%field_type' => $field
          ->getType(),
      )),
      '#type' => 'checkbox',
      '#default_value' => $config
        ->get('entity.support_ticket.' . $field_key),
    );
  }
  return parent::buildForm($form, $form_state);
}