function l10n_client_contributor_form_locale_translate_settings_alter in Localization client 8
Implements hook_form_FORM_ID_alter().
File
- l10n_client_contributor/
l10n_client_contributor.module, line 60 - Submits translations to a remote localization server.
Code
function l10n_client_contributor_form_locale_translate_settings_alter(&$form, FormStateInterface $form_state, $form_id) {
$config = \Drupal::configFactory()
->getEditable('l10n_client_contributor.settings');
$form['l10n_client_contributor_use_server'] = array(
'#title' => t('Enable sharing translation modifications with server'),
'#type' => 'checkbox',
'#default_value' => $config
->get('use_server'),
);
$form['l10n_client_contributor_server'] = array(
'#title' => t('Address of localization server to use'),
'#type' => 'textfield',
'#description' => t('Each local translation submission or change will also be submitted to this server. We suggest you enter <a href="@localize">https://localize.drupal.org/</a> to share with the greater Drupal community. Make sure you set up an API-key in the user account settings for each user that will participate in the translations.', array(
'@localize' => 'https://localize.drupal.org/',
)),
'#default_value' => $config
->get('server'),
'#states' => array(
'visible' => array(
':input[name=l10n_client_contributor_use_server]' => array(
'checked' => TRUE,
),
),
),
);
$form['#validate'][] = 'l10n_client_contributor_form_locale_translate_settings_validate';
$form['#submit'][] = 'l10n_client_contributor_form_locale_translate_settings_submit';
}