function Image::createSourceField

Same name in other branches
  1. 9 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image::createSourceField()
  2. 8.9.x core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image::createSourceField()
  3. 10 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image::createSourceField()

Overrides File::createSourceField

File

core/modules/media/src/Plugin/media/Source/Image.php, line 156

Class

Image
Image entity media source.

Namespace

Drupal\media\Plugin\media\Source

Code

public function createSourceField(MediaTypeInterface $type) {
    
    /** @var \Drupal\field\FieldConfigInterface $field */
    $field = parent::createSourceField($type);
    // Reset the field to its default settings so that we don't inherit the
    // settings from the parent class' source field.
    $settings = $this->fieldTypeManager
        ->getDefaultFieldSettings($field->getType());
    return $field->set('settings', $settings);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.