You are here

protected function FieldItemListProcessor::exportIncludedImages in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/content_synchronizer/type_processor/FieldItemListProcessor.php \Drupal\content_synchronizer\Plugin\content_synchronizer\type_processor\FieldItemListProcessor::exportIncludedImages()
  2. 3.x src/Plugin/content_synchronizer/type_processor/FieldItemListProcessor.php \Drupal\content_synchronizer\Plugin\content_synchronizer\type_processor\FieldItemListProcessor::exportIncludedImages()

Add all the included image in the data.

Parameters

$data: The item data.

1 call to FieldItemListProcessor::exportIncludedImages()
FieldItemListProcessor::getExportedData in src/Plugin/content_synchronizer/type_processor/FieldItemListProcessor.php
Get the data to export.

File

src/Plugin/content_synchronizer/type_processor/FieldItemListProcessor.php, line 41

Class

FieldItemListProcessor
Plugin implementation For the type processor .

Namespace

Drupal\content_synchronizer\Plugin\content_synchronizer\type_processor

Code

protected function exportIncludedImages(&$data) {
  foreach ($data as &$item) {
    foreach ($item as $key => $value) {
      preg_match_all('@src="([^"]+)"@', $value, $match);
      $src = array_pop($match);
      if (!empty($src)) {
        foreach ($src as $image) {
          $this
            ->exportImage($image, $item, $key, $value);
        }
      }
    }
  }
}