Problem/Motivation

In #2831274: Bring Media entity module to core as Media module a refined version of the Media Entity module was moved into core.
In that patch, some renaming happened, and as a consequence the necessary code was adapted.
There is one place though that there is still reference to the old terminology:

In the file /core/modules/media/src/MediaTypeForm.php we have:

...
      '#submit' => [[static::class, 'rebuildSubmit']],
      '#required' => TRUE,
      // Once the media type is created, its source plugin cannot be changed
      // anymore.
      '#disabled' => !empty($source),
    ];

    if (!$source) {
      $form['type']['#empty_option'] = $this->t('- Select media source -');
    }

    if ($source) {
      // Media source plugin configuration.
      $form['source_dependent']['source_configuration'] = [
...

Once there is no $form['type'] element anymore (the new element is called $form['source'], that snippet adding the empty option is useless now.

Proposed resolution

Remove the code:

    if (!$source) {
      $form['type']['#empty_option'] = $this->t('- Select media source -');
    }

from the /core/modules/media/src/MediaTypeForm.php file.

Remaining tasks

- Write a patch
- Review
- Commit

User interface changes

None

API changes

None

Data model changes

None

Comments

marcoscano created an issue. See original summary.

marcoscano’s picture

Status: Active » Postponed
Issue tags: -Novice

Let's try to save this to the sprint on Fri

benjifisher’s picture

Status: Postponed » Active
Issue tags: +Novice
msankhala’s picture

Status: Active » Needs review
StatusFileSize
new598 bytes

Here is a patch.

kporras07’s picture

Status: Needs review » Reviewed & tested by the community

Pretty straightforward. Looks good!

marcoscano’s picture

+1 RTBC, thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Crediting @marcoscano for creating the issue.

Committed 77e3a5c and pushed to 8.6.x. Thanks!

  • alexpott committed 77e3a5c on 8.6.x
    Issue #2959963 by msankhala, marcoscano: Remove obsolete code from...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.