public static function getSourceField(MediaInterface $entity) {
    $field = $entity->getSource()->getSourceFieldDefinition($entity->bundle->entity);

    return $field
      ? $entity->get($field->getName())
      : NULL;
  }
public static function getSourceField(MediaInterface $entity) {
    $field = $entity->getSource()->getSourceFieldDefinition($entity->bundle->entity);

    return $field
      ? $entity->get($field->getName())
      : NULL;
  }
public static function getSourceField ( MediaInterface $ entity ) { $ field = $ entity -> getSource ( ) -> getSourceFieldDefinition ( $ entity -> bundle -> entity ) ; return $ field ? $ entity -> get ( $ field -> getName ( ) ) : NULL ; }
Returns the media entity's source field item list.

@param \Drupal\media\MediaInterface $entity
The media entity.

@return \Drupal\Core\Field\FieldItemListInterface|null
The media entity's source field item list, or NULL if the media type
plugin does not define a source field.
Returns the media entity s source field item list .