Teaser block not visible in block list

ztyx - September 20, 2008 - 17:05
Project:Teaser block
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:ztyx
Status:needs review
Description

/admin/build/block/configure/teaser_block/1 works and is reachable but does not show up in the list at /admin/build/modules.

#1

ztyx - September 21, 2008 - 01:12
Assigned to:Anonymous» ztyx

Follow-up: teaser_block_list() returns all the blocks. But for some reason they are not presented.

#2

ztyx - September 21, 2008 - 01:36

Ah, finally. This bug is related to #252707: Setting $block['status'] but not $block['region'] hides the block in the interface.

I am attaching a patch that should prevent status being set to 1 if region == ''. Should solve the issue.

AttachmentSize
prevent_status_w_no_region.patch 900 bytes

#3

ztyx - September 21, 2008 - 01:37
Status:active» needs review

#4

sun - September 21, 2008 - 02:14

Hm. I did not have any problems. Could you please elaborate under which conditions this bug occurs?

#5

ztyx - September 21, 2008 - 09:45

Sure, I apologize for not writing a more clear bug report. Here we go:
1. Create a Teaser Block. Let it stay in the "Disabled"-region.
2. Go to the node that the Teaser Block is pointing to. Edit its body and press save (Teaser Block should say that it updated the status...).
3. Go back to block listing. Your Teaser Block should not be in the listing anymore.

Do manage to recreate this?

#6

sun - September 21, 2008 - 21:19
Status:needs review» needs work

Ok, I'm able to replicate this bug. However, this patch introduces a wrong behavior instead of fixing the bug - the additional WHERE clause will not update teaser blocks that are properly assigned to a region. So instead of this query, I think we should add this condition to the one right above it, and break the update if no ids are returned then.

#7

ztyx - September 22, 2008 - 23:07

Hmm, I am not sure I fully understand you:

- the additional WHERE clause will not update teaser blocks that are properly assigned to a region.

I think it will. It will update all teaser blocks that are assigned to a region (other than the null/empty region).

The question for me is whether it is necessary to ever update the status of a block when it's in the null region or not.

I am not 100% sure how you would do it by changing the SELECT - with a JOIN?

#8

sun - September 23, 2008 - 02:56
Status:needs work» needs review

You are right that the latest patch prevents that a teaser block, which is not assigned to a region, will be enabled.

The purpose of this update function is to ensure that a teaser block is unpublished when a node is unpublished, because the teaser block would link to an unpublished node otherwise. By adding AND region != '', a disabled block won't be enabled. Did you also test what happens with already enabled blocks? Will they disappear or move to the disabled blocks section? And what happens if the corresponding node is published again? Is the teaser block displayed again?

 
 

Drupal is a registered trademark of Dries Buytaert.