Download & Extend

Block validation allows empty title and body

Project:Drupal core
Version:7.x-dev
Component:block.module
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)
Issue tags:Needs text review, Quick fix, Usability

Issue Summary

Identified at UB Usability Testing: http://www.drupalusability.org/node/130

A user created a block, but did not enter a title or body so they could just see what it would look like. However with both values empty, the block is never actually shown even if it is enabled.

This patch adds validation to check if both title and body are empty, and returns a form error with the text "A block cannot be empty. Please enter either a title or body content."

AttachmentSizeStatusTest resultOperations
block.admin_.inc_.patch1014 bytesIdlePassed: 10585 passes, 0 fails, 0 exceptionsView details | Re-test

Comments

#1

Makes sense, I can't think of any valid reason why one would have a custom block without title and body.

Reviewed the patch and my only concern is the wording (note that English is not my native language, so I can be wrong here): to me, saying "Please enter either a title or body content" implies that you have to enter a title or body content, but not both.

#2

Related to #401214: Custom block body field should be required, it might make sense to merge these 2 issues.

#3

Status:needs review» closed (duplicate)

Marking this as a duplicate of #401214: Custom block body field should be required, as that patch is better (less extra code, code makes more sense and titles don't need to be required)

#4

Conceded, the other patch makes more sense (why didn't I think of that? ;) )