You are here

public function EntityShareMedias::importMedias in Entity Share 7

Import the medias of the providers.

File

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

Class

EntityShareMedias
Class EntityShareMedias.

Code

public function importMedias() {
  foreach ($this
    ->getMediaTypesConfig() as $type => $config) {
    $class = $config['import'];
    $provider = new $class($this->fieldData, $this->fieldName, $this->fieldType, $this->entity, $this->fieldInfo);
    if (!$provider instanceof EntityShareMediasImportInterface) {
      watchdog(self::WATCHDOG_TYPE, 'The media type %type class must implement EntityShareMediasProviderInterface interface !', array(
        '%type' => $type,
      ), WATCHDOG_WARNING);
      continue;
    }
    if ($provider
      ->isManagedFieldType()) {
      $provider
        ->importMedias();
    }
  }
}