public function HostsSetterController::setHosts in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8.2 tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 4.0.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 3.0.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 3.1.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 3.3.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 3.4.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 3.5.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 3.6.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 3.7.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
- 3.8.x tests/modules/lingotek_test/src/Controller/HostsSetterController.php \Drupal\lingotek_test\Controller\HostsSetterController::setHosts()
Helper method for setting up a valid host for testing.
Required for the workbench links.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request.
Return value
\Symfony\Component\HttpFoundation\JsonResponse A JSON response with the current basepath and a success message.
1 string reference to 'HostsSetterController::setHosts'
- lingotek_test.routing.yml in tests/
modules/ lingotek_test/ lingotek_test.routing.yml - tests/modules/lingotek_test/lingotek_test.routing.yml
File
- tests/
modules/ lingotek_test/ src/ Controller/ HostsSetterController.php, line 52
Class
- HostsSetterController
- Controller for pointing up the host and sandbox in config to the local site.
Namespace
Drupal\lingotek_test\ControllerCode
public function setHosts(Request $request) {
$basepath = $request
->getSchemeAndHttpHost();
$config = $this->configFactory
->getEditable('lingotek.settings');
$config
->set('account.use_production', TRUE)
->set('account.sandbox_host', $basepath)
->set('account.host', $basepath);
$config
->save();
return new JsonResponse([
'message' => 'Success setting host to ' . $basepath,
'basepath' => $basepath,
]);
}