Problem/Motivation

PHP notices are given when using only H5P Upload widget.

Notice: Undefined index: metadata in Drupal\h5p\H5PDrupal\H5PDrupal->insertContent() (line 868 of /var/www/html/modules/contrib/h5p/src/H5PDrupal/H5PDrupal.php)

Steps to reproduce

1. Install 2.0.0 branch, Drupal 9.4 - 11.2
2. Add H5P field to Basic page content type, set its widget to "H5P Upload".
3. Download https://h5p.org/tutorial-image-hotspots from "Reuse" link.
4. Create a new Basic page and upload the downloaded .h5p file to H5P field.
5. File uploads correctly, but produces PHP notices on log/screen.

CommentFileSizeAuthor
#2 3309418-h5p-upload-widget-notices-2.patch643 bytessokru

Issue fork h5p-3309418

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

sokru created an issue. See original summary.

sokru’s picture

Status: Active » Needs review
StatusFileSize
new643 bytes

Not sure this is the correct way, but the patch removes the notices.

msandoval made their first commit to this issue’s fork.

msandoval’s picture

Issue exists in D11 as well. Can be tested if based off of https://www.drupal.org/project/h5p/issues/3542700. (Otherwise H5P Upload field widget has blocking errors for reproduction.)

I've confirmed this does resolve the warning, when paired with 3542700.

frob’s picture

Issue summary: View changes

The IS references Drupal 9.4. I updated to reference D11

illeace’s picture

Version: 2.0.0-alpha2 » 2.0.x-dev
Status: Needs review » Reviewed & tested by the community

This looks good. I've tested:
- before and after the fix
- on a D10 and D11 site
Everything works as expected and the fix seems reasonable. Marking RTBC.

sim_1 made their first commit to this issue’s fork.

  • sim_1 committed 6193165a on 2.0.x authored by msandoval
    [#3309418] fix: H5P Upload widget PHP notices
    
    By: sokru
    By: msandoval...
sim_1’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Merged and marking as fixed.

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

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

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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