You are here

public function TmgmtSmartlingContextDebugForm::buildForm in TMGMT Translator Smartling 8

Same name and namespace in other branches
  1. 8.4 modules/tmgmt_smartling_context_debug/src/Form/TmgmtSmartlingContextDebugForm.php \Drupal\tmgmt_smartling_context_debug\Form\TmgmtSmartlingContextDebugForm::buildForm()
  2. 8.2 modules/tmgmt_smartling_context_debug/src/Form/TmgmtSmartlingContextDebugForm.php \Drupal\tmgmt_smartling_context_debug\Form\TmgmtSmartlingContextDebugForm::buildForm()
  3. 8.3 modules/tmgmt_smartling_context_debug/src/Form/TmgmtSmartlingContextDebugForm.php \Drupal\tmgmt_smartling_context_debug\Form\TmgmtSmartlingContextDebugForm::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

modules/tmgmt_smartling_context_debug/src/Form/TmgmtSmartlingContextDebugForm.php, line 26

Class

TmgmtSmartlingContextDebugForm
Form that helps to debug Smartling Context.

Namespace

Drupal\tmgmt_smartling_context_debug\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['do_direct_output'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show the context snapshot of the page in a browser.'),
    '#description' => 'If checked, the context will be shown on this page instead of being sent to Smartling.',
    '#default_value' => FALSE,
    '#required' => FALSE,
  ];
  $form['filename'] = [
    '#type' => 'textfield',
    '#title' => t('FileName'),
    '#description' => t('FileName of a Job'),
    '#default_value' => '',
    '#size' => 25,
    '#maxlength' => 25,
  ];
  $form['url'] = [
    '#type' => 'textfield',
    '#title' => t('URL'),
    '#description' => t('URL of the page to extract the context for'),
    '#default_value' => '',
    '#size' => 25,
    '#maxlength' => 125,
    '#required' => TRUE,
  ];
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => $this
      ->t('Test context'),
    '#button_type' => 'primary',
  );
  return $form;
}