You are here

public function LingotekSettingsTabUtilitiesForm::updateCallbackUrl in Lingotek Translation 3.6.x

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

File

src/Form/LingotekSettingsTabUtilitiesForm.php, line 172

Class

LingotekSettingsTabUtilitiesForm
Tab for running Lingotek utilities in the settings page.

Namespace

Drupal\lingotek\Form

Code

public function updateCallbackUrl() {
  $new_callback_url = \Drupal::urlGenerator()
    ->generateFromRoute('lingotek.notify', [], [
    'absolute' => TRUE,
  ]);
  $config = $this
    ->configFactory()
    ->get('lingotek.settings');
  $configEditable = $this
    ->configFactory()
    ->getEditable('lingotek.settings');
  $configEditable
    ->set('account.callback_url', $new_callback_url);
  $configEditable
    ->save();
  $defaultProject = $config
    ->get('default.project');
  $new_response = $this->lingotek
    ->setProjectCallBackUrl($defaultProject, $new_callback_url);
  if ($new_response) {
    $this
      ->messenger()
      ->addStatus($this
      ->t('The callback URL has been updated.'));
  }
}