You are here

public function LingotekSettingsController::getProfileListForm in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  2. 4.0.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  3. 3.0.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  4. 3.1.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  5. 3.2.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  6. 3.3.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  7. 3.4.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  8. 3.5.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  9. 3.6.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  10. 3.7.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()
  11. 3.8.x src/Controller/LingotekSettingsController.php \Drupal\lingotek\Controller\LingotekSettingsController::getProfileListForm()

Gets the profile list form wrapped, so it can be expanded and collapsed.

Return value

array The form definition.

1 call to LingotekSettingsController::getProfileListForm()
LingotekSettingsController::content in src/Controller/LingotekSettingsController.php

File

src/Controller/LingotekSettingsController.php, line 39

Class

LingotekSettingsController

Namespace

Drupal\lingotek\Controller

Code

public function getProfileListForm() {
  $form_builder = \Drupal::formBuilder();
  $original_form = $form_builder
    ->getForm($this
    ->entityManager()
    ->getListBuilder('lingotek_profile'), new FormState());
  $form['profiles_wrapper'] = array(
    '#type' => 'details',
    '#title' => $this
      ->t('Translation Profiles'),
  );
  $form['profiles_wrapper']['form'] = $original_form;

  // We add the link manually, as we cannot use local actions for that.
  $form['profiles_wrapper']['form']['add_link'] = [
    '#type' => 'link',
    '#title' => t('Add new Translation Profile'),
    '#url' => Url::fromRoute('entity.lingotek_profile.add_form'),
    '#weight' => 50,
    '#ajax' => array(
      'class' => array(
        'use-ajax',
      ),
    ),
    '#attributes' => array(
      'class' => array(
        'use-ajax',
      ),
      'data-dialog-type' => 'modal',
      'data-dialog-options' => Json::encode(array(
        'width' => 860,
        'height' => 530,
      )),
    ),
  ];
  return $form;
}