You are here

public function TranslatorPluginUiBase::addConnectButton in Translation Management Tool 8

Adds a "Connect" button to a form.

Return value

array A form array containing "Connect" button.

File

src/TranslatorPluginUiBase.php, line 106

Class

TranslatorPluginUiBase
Default ui controller class for translator plugins.

Namespace

Drupal\tmgmt

Code

public function addConnectButton() {
  $form['connect'] = array(
    '#type' => 'submit',
    '#value' => t('Connect'),
    '#submit' => [
      [
        TranslatorForm::class,
        'updateRemoteLanguagesMappings',
      ],
      [
        $this,
        'submitConnect',
      ],
    ],
    '#limit_validation_errors' => array(
      array(
        'settings',
      ),
    ),
    '#executes_submit_callback' => TRUE,
    '#ajax' => [
      'callback' => [
        TranslatorForm::class,
        'ajaxTranslatorPluginSelect',
      ],
      'wrapper' => 'tmgmt-plugin-wrapper',
    ],
  );
  return $form;
}