Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MediaSourceBase.php

function MediaSourceBase::prepareFormDisplay

Overrides MediaSourceInterface::prepareFormDisplay

2 calls to MediaSourceBase::prepareFormDisplay()
OEmbed::prepareFormDisplay in core/modules/media/src/Plugin/media/Source/OEmbed.php
Prepares the media type fields for this source in the form display.
OEmbed::prepareFormDisplay in core/modules/media/src/Plugin/media/Source/OEmbed.php
Prepares the media type fields for this source in the form display.
1 method overrides MediaSourceBase::prepareFormDisplay()
OEmbed::prepareFormDisplay in core/modules/media/src/Plugin/media/Source/OEmbed.php
Prepares the media type fields for this source in the form display.

File

core/modules/media/src/MediaSourceBase.php, line 366

Class

MediaSourceBase
Base implementation of media source plugin.

Namespace

Drupal\media

Code

public function prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayInterface $display) {
    // Make sure the source field is placed just after the "name" base field.
    $name_component = $display->getComponent('name');
    $source_field_weight = $name_component && isset($name_component['weight']) ? $name_component['weight'] + 5 : -50;
    $display->setComponent($this->getSourceFieldDefinition($type)
        ->getName(), [
        'weight' => $source_field_weight,
    ]);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal