You are here

public function ExportConfirmForm::onAddToExport in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Form/ExportConfirmForm.php \Drupal\content_synchronizer\Form\ExportConfirmForm::onAddToExport()
  2. 3.x src/Form/ExportConfirmForm.php \Drupal\content_synchronizer\Form\ExportConfirmForm::onAddToExport()

Add entity to an existing entity export.

Parameters

array $form: The form build array.

\Drupal\Core\Form\FormStateInterface $formState: The form state.

File

src/Form/ExportConfirmForm.php, line 182

Class

ExportConfirmForm
Class ExportConfirmForm.

Namespace

Drupal\content_synchronizer\Form

Code

public function onAddToExport(array &$form, FormStateInterface $formState) {
  $exportsList = ExportEntity::loadMultiple($formState
    ->getValue('exports_list'));
  foreach ($this
    ->getEntities() as $entity) {

    /** @var \Drupal\content_synchronizer\Entity\ExportEntity $export */
    foreach ($exportsList as $export) {
      $export
        ->addEntity($entity);
    }
  }
}