You are here

protected function EntityShareEmbeddedEntitiesEnhancer::doUndoTransform in Entity Share 8.3

File

src/Plugin/jsonapi/FieldEnhancer/EntityShareEmbeddedEntitiesEnhancer.php, line 71

Class

EntityShareEmbeddedEntitiesEnhancer
Alter rich text exposed data to provide import URL for embedded entities.

Namespace

Drupal\entity_share\Plugin\jsonapi\FieldEnhancer

Code

protected function doUndoTransform($data, Context $context) {

  // Formatted text detection.
  if (!isset($data['format']) || !isset($data['value'])) {
    return $data;
  }
  $data['value'] = preg_replace_callback('#(<.*data-entity-type="(.*)".*data-entity-uuid="(.*)".*)(/?)>#U', [
    self::class,
    'addEntityJsonapiUrl',
  ], $data['value']);
  return $data;
}