function Image::createSourceField

Same name in other branches
  1. 8.9.x core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image::createSourceField()
  2. 10 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image::createSourceField()
  3. 11.x 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 155

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.