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

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

    XporterXMLWordPrintable

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Should have
    • Resolution: Merged
    • Affects Version/s: None
    • Fix Version/s: 2.58.2
    • Labels:
      None
    • Story Points:
      5
    • Sprint:
      Sprint #163
    • Section:
      Block: Media
    • Track:
      Development
    • P4 Test Environment:
      uranus
    • Repositories:
      planet4-plugin-gutenberg-blocks

      Description

      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

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              sdeshmuk Sagar Deshmukh
              Reporter:
              fhernand Florent Hernandez
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: