You are here

protected function AddFormBase::getSourceFieldName in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::getSourceFieldName()
  2. 9 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.

2 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.

File

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

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();
}