You are here

public static function EntityStatus::accessTemporaryPushToPoolInfoForField 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::accessTemporaryPushToPoolInfoForField()
  2. 2.0.x src/Entity/EntityStatus.php \Drupal\cms_content_sync\Entity\EntityStatus::accessTemporaryPushToPoolInfoForField()

Parameters

mixed $entity_type:

mixed $uuid:

mixed $field_name:

mixed $delta:

mixed $tree_position:

null|mixed $set_flow_id:

null|mixed $set_pool_ids:

null|mixed $set_uuid:

3 calls to EntityStatus::accessTemporaryPushToPoolInfoForField()
DefaultEntityReferenceHandler::saveEmbeddedPushToPools in src/Plugin/cms_content_sync/field_handler/DefaultEntityReferenceHandler.php
Save the push settings the user selected for paragraphs.
EntityStatus::saveSelectedPushToPoolForField in src/Entity/EntityStatus.php
_cms_content_sync_set_entity_push_subform in ./cms_content_sync.module

File

src/Entity/EntityStatus.php, line 302

Class

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

Namespace

Drupal\cms_content_sync\Entity

Code

public static function accessTemporaryPushToPoolInfoForField($entity_type, $uuid, $field_name, $delta, $tree_position = [], $set_flow_id = null, $set_pool_ids = null, $set_uuid = null) {
  static $field_storage = [];
  if ($set_flow_id && $set_pool_ids) {
    $data = [
      'flow_id' => $set_flow_id,
      'pool_ids' => $set_pool_ids,
      'uuid' => $set_uuid,
    ];
    if (!isset($field_storage[$entity_type][$uuid])) {
      $field_storage[$entity_type][$uuid] = [];
    }
    $setter =& $field_storage[$entity_type][$uuid];
    foreach ($tree_position as $name) {
      if (!isset($setter[$name])) {
        $setter[$name] = [];
      }
      $setter =& $setter[$name];
    }
    if (!isset($setter[$field_name][$delta])) {
      $setter[$field_name][$delta] = [];
    }
    $setter =& $setter[$field_name][$delta];
    $setter = $data;
  }
  else {
    if (!empty($field_storage[$entity_type][$uuid])) {
      $value = $field_storage[$entity_type][$uuid];
      foreach ($tree_position as $name) {
        if (!isset($value[$name])) {
          return null;
        }
        $value = $value[$name];
      }
      return isset($value[$field_name][$delta]) ? $value[$field_name][$delta] : null;
    }
  }
  return null;
}