You are here

public static function EntityStatus::saveSelectedPushToPoolForField in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Entity/EntityStatus.php \Drupal\cms_content_sync\Entity\EntityStatus::saveSelectedPushToPoolForField()
  2. 2.0.x src/Entity/EntityStatus.php \Drupal\cms_content_sync\Entity\EntityStatus::saveSelectedPushToPoolForField()

Parameters

\Drupal\Core\Entity\EntityInterface $parent_entity:

string $parent_field_name:

int $parent_field_delta:

\Drupal\Core\Entity\EntityInterface $reference:

array $tree_position:

1 call to EntityStatus::saveSelectedPushToPoolForField()
DefaultEntityReferenceHandler::saveEmbeddedPushToPools in src/Plugin/cms_content_sync/field_handler/DefaultEntityReferenceHandler.php
Save the push settings the user selected for paragraphs.

File

src/Entity/EntityStatus.php, line 351

Class

EntityStatus
Defines the "Content Sync - Entity Status" entity type.

Namespace

Drupal\cms_content_sync\Entity

Code

public static function saveSelectedPushToPoolForField($parent_entity, $parent_field_name, $parent_field_delta, $reference, $tree_position = []) {
  $data = EntityStatus::accessTemporaryPushToPoolInfoForField($parent_entity
    ->getEntityTypeId(), $parent_entity
    ->uuid(), $parent_field_name, $parent_field_delta, $tree_position);

  // On sites that don't push, this will be NULL.
  if (empty($data['flow_id'])) {
    return;
  }
  $values = $data['pool_ids'];
  $processed = [];
  if (is_array($values)) {
    foreach ($values as $id => $selected) {
      if ($selected && 'ignore' !== $id) {
        $processed[] = $id;
      }
    }
  }
  else {
    if ('ignore' !== $values) {
      $processed[] = $values;
    }
  }
  EntityStatus::saveSelectedPoolsToPushTo($reference, $data['flow_id'], $processed, $parent_entity, $parent_field_name);
}