Problem/Motivation

MyrestImageBuilder::getStructureMediaImages() calls getSource() on every entity the field references. When the field references files — an image field under the same name, which is an ordinary way to model a picture — the response fatals with Call to undefined method ...File::getSource(). Its neighbour getStructureMediaImage() checks instanceof MediaInterface first and does not.

A module meant to work on the model a site actually has must not fatal because a site chose a file field where another chose media.

Proposed resolution

  • Skip anything that is not media, the way the single-image method does.
  • Better: answer an image field with the same structure as a media image, so that both modellings produce the key rather than one of them producing nothing.
  • A kernel test with both kinds of field under the same name.

Remaining tasks

Everything.

Issue fork myrest-3625521

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sergeydruua created an issue. See original summary.

  • sergeydruua committed 74492906 on 1.0.x
    Issue #3625521: Answer media image structures on a field that is not...
sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)