You are here

protected function EntityShareMediasProviderAbstract::rteEmbeddedMedia in Entity Share 7

Treatment on the RTE field to match fid, etc.

Parameters

array $field_data: Data of the field for a language.

Closure $callback: Callback called for each embedded medias.

string $pattern: Pattern to match in th RTE data to find embedded media.

2 calls to EntityShareMediasProviderAbstract::rteEmbeddedMedia()
EntityShareMediasScaldExport::rteManagement in modules/entity_share_medias/modules/entity_share_medias_scald/includes/entity_share_medias_scald.export.inc
Alter RTE datas.
EntityShareMediasScaldImport::rteManagement in modules/entity_share_medias/modules/entity_share_medias_scald/includes/entity_share_medias_scald.import.inc
Alter RTE datas.

File

modules/entity_share_medias/includes/entity_share_medias.inc, line 187
Class for handling Medias.

Class

EntityShareMediasProviderAbstract
Class EntityShareMediasProviderAbstract.

Code

protected function rteEmbeddedMedia(array &$field_data, Closure $callback, $pattern = '/"fid":"(.+?)"/') {
  foreach ($field_data as $key => &$value) {
    if (in_array($key, $this->rteKeys)) {

      // Match all the embedded files.
      if (preg_match_all($pattern, $value, $matches, PREG_SET_ORDER)) {
        $callback($matches, $value);
      }
    }
  }
}