LingotekSettingsEditDefaultsForm.php in Lingotek Translation 8.2
Same filename and directory in other branches
- 8 src/Form/LingotekSettingsEditDefaultsForm.php
- 4.0.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.0.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.1.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.2.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.3.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.4.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.5.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.6.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.7.x src/Form/LingotekSettingsEditDefaultsForm.php
- 3.8.x src/Form/LingotekSettingsEditDefaultsForm.php
Namespace
Drupal\lingotek\FormFile
src/Form/LingotekSettingsEditDefaultsForm.phpView source
<?php
namespace Drupal\lingotek\Form;
use Drupal\Core\Form\FormStateInterface;
/**
* Form for editing defaults.
*/
class LingotekSettingsEditDefaultsForm extends LingotekSettingsDefaultsForm {
/**
* {@inheritDoc}
*/
public function init() {
$this->defaults_labels['community'] = t('Default Community');
$this->defaults_labels['project'] = t('Default Project');
$this->defaults_labels['workflow'] = t('Default Workflow');
$this->defaults_labels['vault'] = t('Default Vault');
parent::init();
}
/**
* {@inheritDoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// When editing, we redirect to the account form, and we don't notify
// about callback url.
$config = $this
->configFactory()
->getEditable('lingotek.settings');
$form_values = $form_state
->getValues();
foreach ($this->defaults_labels as $key => $label) {
$config
->set('default.' . $key, $form_values[$key]);
}
$config
->save();
$form_state
->setRedirect('lingotek.settings');
}
}
Classes
Name | Description |
---|---|
LingotekSettingsEditDefaultsForm | Form for editing defaults. |