You are here

public function LingotekProfileListBuilder::submitForm in Lingotek Translation 8

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

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides DraggableListBuilder::submitForm

File

src/LingotekProfileListBuilder.php, line 141

Class

LingotekProfileListBuilder
Defines a class to build a listing of Lingotek profile entities.

Namespace

Drupal\lingotek

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Parent submit handler takes care of the weights, but not the checkboxes.
  parent::submitForm($form, $form_state);
  foreach ($this->entities as $entity_id => $entity) {
    if (!$entity
      ->isLocked() && ($entity
      ->hasAutomaticUpload() != $form_state
      ->getValue([
      'profile',
      $entity_id,
      'auto_upload',
    ]) || $entity
      ->hasAutomaticDownload() != $form_state
      ->getValue([
      'profile',
      $entity_id,
      'auto_download',
    ]))) {
      $entity
        ->setAutomaticUpload($form_state
        ->getValue([
        'profile',
        $entity_id,
        'auto_upload',
      ]));
      $entity
        ->setAutomaticDownload($form_state
        ->getValue([
        'profile',
        $entity_id,
        'auto_download',
      ]));
      $entity
        ->save();
    }
  }
  drupal_set_message(t('Configuration saved.'));
}