At admin/structure/dashboard there is an empty block at the foot of the list, which can't be moved.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Haza’s picture

FileSize
688 bytes

hummm
block.admin.inc, we add system_main key

 // Do not allow disabling the main system content block.
  $form['blocks']['system_main']['region']['#required'] = TRUE;

Not sure what is this system_main blocks, any clues ?

btw, if we check if the key is present before trying to force the requiered = TRUE, it could resolve the issue. But i'am really not sure about that.

David_Rothstein’s picture

Status: Active » Needs review

This is fallout from #140783: A select list without #default_value always passes form validation (and the cleanup patch there at http://drupal.org/node/140783#comment-3501422 fixed this plus several other things) - however, that issue turned into a long mess and it will take time to sort it all out; it seems very reasonable to fix this one separately :)

'system_main' is the main content block, which is usually present on the form when the Block module uses it, but not when the Dashboard module reuses it, so indeed, checking isset() is a reasonable fix.

I'd probably suggest checking isset($form['blocks']['system_main']['region']) as the patch at the above issue did, though - might as well go all the way and check as deep in the array as we want to go.

Also, it's minor, but:

-  // Do not allow disabling the main system content block.
-  $form['blocks']['system_main']['region']['#required'] = TRUE;
-

Please don't remove the blank line at the end. It's needed to logically separate this block of code from what comes after it.

With those changes I'd say this is RTBC - thanks!

Status: Needs review » Needs work

The last submitted patch, d7.936582.patch, failed testing.

joachim’s picture

Status: Needs work » Needs review
FileSize
821 bytes

That'll be the git patches not applying ;)

Here's a reroll with the changes suggested in #2.

I've changed the comment too, as otherwise I think someone reading this function in block module could legitimately wonder why on earth we need to test the block is there first. Maybe worth even explicitly saying 'because dashboard module generates this form without it', but I can't think of a concise way to say that....

David_Rothstein’s picture

Status: Needs review » Reviewed & tested by the community

Looks perfect.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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