You are here

function tmgmt_content_settings_submit in Translation Management Tool 8

Submit function set by tmgmt_content_form_tmgmt_settings_form_alter().

1 string reference to 'tmgmt_content_settings_submit'
tmgmt_content_form_tmgmt_settings_form_alter in sources/content/tmgmt_content.module
Implements hook_form_FORM_ID_alter() for tmgmt_settings_form().

File

sources/content/tmgmt_content.module, line 266
Source plugin for the Translation Management system that handles entities.

Code

function tmgmt_content_settings_submit(array &$form, FormStateInterface $form_state) {
  $embedded_fields = array();
  foreach ($form_state
    ->getValue('embedded_fields', []) as $key => $fields) {
    foreach (array_filter($fields) as $id => $label) {
      $embedded_fields[$key][$id] = TRUE;
    }
  }
  \Drupal::configFactory()
    ->getEditable('tmgmt_content.settings')
    ->set('embedded_fields', $embedded_fields)
    ->set('default_moderation_states', $form_state
    ->getValue('default_moderation_states', []))
    ->save();
}