You are here

protected function AddFormBase::getSourceFieldName in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::getSourceFieldName()
  2. 10 core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::getSourceFieldName()

Returns the name of the source field for a media type.

Parameters

\Drupal\media\MediaTypeInterface $media_type: The media type to get the source field name for.

Return value

string The name of the media type's source field.

3 calls to AddFormBase::getSourceFieldName()
AddFormBase::buildEntityFormElement in core/modules/media_library/src/Form/AddFormBase.php
Builds the sub-form for setting required fields on a new media item.
AddFormBase::processInputValues in core/modules/media_library/src/Form/AddFormBase.php
Creates media items from source field input values.
FileUploadForm::buildEntityFormElement in core/modules/media_library/src/Form/FileUploadForm.php
Builds the sub-form for setting required fields on a new media item.

File

core/modules/media_library/src/Form/AddFormBase.php, line 796

Class

AddFormBase
Provides a base class for creating media items from within the media library.

Namespace

Drupal\media_library\Form

Code

protected function getSourceFieldName(MediaTypeInterface $media_type) {
  return $media_type
    ->getSource()
    ->getSourceFieldDefinition($media_type)
    ->getName();
}