You are here

protected function CronHandler::getInstagramSourceField in Instagram Feeds 8

Gets Media source plugin field system name.

Parameters

string $media_type_name: The Instagram media type system name.

Return value

string Field system name or NULL.

File

src/CronHandler.php, line 315

Class

CronHandler
Instagram Feeds Cron Handler Service.

Namespace

Drupal\instagram_feeds

Code

protected function getInstagramSourceField($media_type_name) : string {
  if (!isset($this->mediaTypeSources[$media_type_name])) {

    /** @var \Drupal\media\MediaTypeInterface $mediaType */
    $mediaType = $this->entityTypeManager
      ->getStorage('media_type')
      ->load($media_type_name);
    $this->mediaTypeSources[$media_type_name] = $mediaType
      ->getSource()
      ->getSourceFieldDefinition($mediaType)
      ->getName();
  }
  return $this->mediaTypeSources[$media_type_name];
}