Uploaded image for project: 'Planet4'
  1. Planet4
  2. PLANET-6009

A Media Block with empty url field generates a notice and a false block

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Merged
    • Icon: Should have Should have
    • 2.58.2
    • None
    • 5
    • Block: Media
    • Sprint #163

      It is possible to add a Media block without a media URL specified; this situation will generate a PHP notice

      Notice:  Undefined index: youtube_id in /app/source/public/wp-content/plugins/planet4-plugin-gutenberg-blocks/classes/blocks/class-media.php on line 92
      

      and display a string false on frontend.

      This error is locally available on url planet4.test/testing-all-blocks-default-template/

      Tasks:

      • For existing content
        • Fix Notice (check youtube_id entry, return early when no url is found)
        • Fix frontend block (MediaEmbedPreview should not be used if media_url is empty)
      • For new content
        • Check if the Media URL field should be mandatory for this block
        • Add a check on the Post Publish validation

            sdeshmuk Sagar Deshmukh
            fhernand Florent Hernandez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: