You are here

class LingotekSettingsConnectForm in Lingotek Translation 3.5.x

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

Configure Lingotek

Hierarchy

Expanded class hierarchy of LingotekSettingsConnectForm

2 files declare their use of LingotekSettingsConnectForm
LingotekSettingsConnectFormTest.php in tests/src/Unit/Form/LingotekSettingsConnectFormTest.php
LingotekSetupController.php in src/Controller/LingotekSetupController.php

File

src/Form/LingotekSettingsConnectForm.php, line 11

Namespace

Drupal\lingotek\Form
View source
class LingotekSettingsConnectForm extends LingotekConfigFormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'lingotek.connect_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    // build the redirecting link for authentication to Lingotek
    $config = $this->configFactory
      ->get('lingotek.settings');
    $host = $config
      ->get('account.host');
    $auth_path = $config
      ->get('account.authorize_path');
    $id = $config
      ->get('account.default_client_id');
    $return_uri = $this->urlGenerator
      ->generateFromRoute('lingotek.setup_account_handshake', [
      'success' => 'true',
      'prod' => 'prod',
    ], [
      'absolute' => TRUE,
    ]);
    $lingotek_register_link = $host . '/' . 'lingopoint/portal/requestAccount.action?client_id=' . $id . '&response_type=token&app=' . urlencode($return_uri);
    $lingotek_connect_link = $host . '/' . $auth_path . '?client_id=' . $id . '&response_type=token&redirect_uri=' . urlencode($return_uri);
    $lingotek_demo_link = 'https://www.lingotek.com/request-demo';
    $form = [];
    $form['intro_title'] = [
      '#prefix' => '<h1>',
      '#markup' => $this
        ->t('Lingotek | The Translation Network&trade;'),
      '#suffix' => '</h1>',
    ];
    $form['intro_paragraph'] = [
      '#prefix' => '<p>',
      '#markup' => $this
        ->t('Lingotek is more than an enterprise-class Translation Management System (TMS), it is a completely integrated translation hub that combines an industry-leading cloud TMS, Linguistic Quality Evaluation (LQE), multilingual Application Program Interfaces (API) and connectors, with professional linguists who are experts in using our technology.'),
      '#suffix' => '</p>',
    ];
    $form['money_title'] = [
      '#prefix' => '<h2>',
      '#markup' => $this
        ->t('So How Does Lingotek Make Money?'),
      '#suffix' => '</h2>',
    ];
    $form['money_paragraph'] = [
      '#prefix' => '<p>',
      '#markup' => $this
        ->t("For most of those using the module we don't. That's part of our contribution to the community. In fact, we're the only module that offers the community free machine translation (the cost is covered by Lingotek for up to 100,000 characters). However, a few of the larger Drupal sites that use the module have enterprise business requirements which require direct access to Lingotek's cloud-based TMS. In those cases, we sell them licenses for unrestricted use of our TMS software. Lingotek offers extensive professional translation and localization services. Lingotek's Language Services team includes professional, in-country linguists, localization project managers, and localization engineers - all of whom ensure the highest-quality of translations. Should you have existing translators or vendors, it is possible to continue working with them on the Lingotek TMS. Paid users of Lingotek's cloud-based translation management system (TMS) can leverage customizable workflows based on content type or language as well as leverage linguistic assets such as glossaries, style guides and translation memory."),
      '#suffix' => '</p>',
    ];
    $form['account_types'] = [
      '#type' => 'container',
      '#attributes' => [
        'class' => 'lingotek_signup_types',
      ],
    ];
    $form['account_types']['existing_account'] = [
      '#type' => 'container',
      '#attributes' => [
        'class' => 'lingotek_signup_box',
      ],
    ];
    $form['account_types']['existing_account']['title'] = [
      '#prefix' => '<h3>',
      '#markup' => $this
        ->t('Connect existing account'),
      '#suffix' => '</h3>',
    ];
    $form['account_types']['existing_account']['body'] = [
      '#prefix' => '<div class="lingotek_signup_box_main">',
      '#markup' => $this
        ->t('Connect using your existing Lingotek account.'),
      '#suffix' => '</div>',
    ];
    $form['account_types']['existing_account']['cta'] = [
      '#type' => 'link',
      '#title' => $this
        ->t('Connect Lingotek Account'),
      '#url' => Url::fromUri($lingotek_connect_link),
      '#attributes' => [
        'class' => [
          'lingotek_signup_box_cta',
          'lingotek_signup_box_main_cta',
        ],
      ],
    ];
    $form['account_types']['free_account'] = [
      '#type' => 'container',
      '#attributes' => [
        'class' => 'lingotek_signup_box',
      ],
    ];
    $form['account_types']['free_account']['title'] = [
      '#prefix' => '<h3>',
      '#markup' => $this
        ->t('Get Free account'),
      '#suffix' => '</h3>',
    ];
    $form['account_types']['free_account']['body'] = [
      '#theme' => 'item_list',
      '#items' => [
        $this
          ->t('Translation Management Dashboard'),
        $this
          ->t('Lingotek Translation Workbench (CAT Tool)'),
        $this
          ->t('Unlimited Languages'),
        $this
          ->t('Drupal Community Support'),
        $this
          ->t('Machine Translation Only (100K Characters)'),
      ],
      '#attributes' => [
        'class' => 'lingotek_signup_box_main',
      ],
    ];
    $form['account_types']['free_account']['cta'] = [
      '#type' => 'link',
      '#title' => $this
        ->t('Get started'),
      '#url' => Url::fromUri($lingotek_register_link),
      '#attributes' => [
        'class' => 'lingotek_signup_box_cta',
      ],
    ];
    $form['account_types']['enterprise_account'] = [
      '#type' => 'container',
      '#attributes' => [
        'class' => 'lingotek_signup_box',
      ],
    ];
    $form['account_types']['enterprise_account']['title'] = [
      '#prefix' => '<h3>',
      '#markup' => $this
        ->t('Get Enterprise account'),
      '#suffix' => '</h3>',
    ];
    $form['account_types']['enterprise_account']['body'] = [
      '#theme' => 'item_list',
      '#items' => [
        $this
          ->t('Professional Translation Workflows'),
        $this
          ->t('Translation Memory & Terminology'),
        $this
          ->t('In-Context Translation Workbench'),
        $this
          ->t('Multilingual Drupal Site Audit & Support'),
        $this
          ->t('Translation Project Management'),
        $this
          ->t('Linguistic Quality Evaluation*'),
        $this
          ->t('Multilingual Business Intelligence*'),
      ],
      '#attributes' => [
        'class' => 'lingotek_signup_box_main',
      ],
    ];
    $form['account_types']['enterprise_account']['cta'] = [
      '#type' => 'link',
      '#title' => $this
        ->t('Contact Lingotek'),
      '#url' => Url::fromUri($lingotek_demo_link),
      '#attributes' => [
        'class' => 'lingotek_signup_box_cta',
        'target' => '_blank',
      ],
    ];
    $form['#attributes']['class'][] = 'lingotek_signup';
    $form['#attached']['library'][] = 'lingotek/lingotek.signup';
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

    // do nothing for now
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigFormBaseTrait::config protected function Retrieves a configuration object.
DependencySerializationTrait::$_entityStorages protected property
DependencySerializationTrait::$_serviceIds protected property
DependencySerializationTrait::__sleep public function 2
DependencySerializationTrait::__wakeup public function 2
FormBase::$configFactory protected property The config factory. 3
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::configFactory protected function Gets the config factory for this form. 3
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route.
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
FormBase::validateForm public function Form validation handler. Overrides FormInterface::validateForm 72
LingotekConfigFormBase::$lingotek protected property
LingotekConfigFormBase::$linkGenerator protected property The link generator.
LingotekConfigFormBase::$urlGenerator protected property The URL generator.
LingotekConfigFormBase::create public static function Instantiates a new instance of this class. Overrides ConfigFormBase::create 5
LingotekConfigFormBase::getEditableConfigNames public function Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait::getEditableConfigNames
LingotekConfigFormBase::__construct public function Constructs a \Drupal\lingotek\Form\LingotekConfigFormBase object. Overrides ConfigFormBase::__construct 5
LingotekSettingsConnectForm::buildForm public function Form constructor. Overrides ConfigFormBase::buildForm
LingotekSettingsConnectForm::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId
LingotekSettingsConnectForm::submitForm public function Form submission handler. Overrides ConfigFormBase::submitForm
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 27
MessengerTrait::messenger public function Gets the messenger. 27
MessengerTrait::setMessenger public function Sets the messenger.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.