When configuring a block after this module is installed, I encounter the following warning:

Strict warning: Creating default object from empty value in block_class_form_alter() (line 27 of C:\WEB\Staging\mi-top_drupal\sites\all\modules\block_class\block_class.module).

The classes I apply are saved and display properly on the front-end.

I'm using Drupal 7.7

Comments

Skydda’s picture

Take a look at your sites/all/modules/block_class/block_class.module

This is what it looked before my little tweak:

 function block_class_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'block_admin_configure' || $form_id == 'block_add_block_form') {
	$block->module = $form['module']['#value']; //LINE 27
    $block->delta = $form['delta']['#value'];
    $css_class = block_class($block);

And this is what it looks like after my tweak:

 function block_class_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'block_admin_configure' || $form_id == 'block_add_block_form') {
    $block = new stdClass;
	$block->module = $form['module']['#value']; //LINE 28
    $block->delta = $form['delta']['#value'];
    $css_class = block_class($block);

It doesn't display warning for me :)

Anonymous’s picture

That worked. Thanks!

mikeinvaldosta’s picture

Thanks, Skydda

metaface’s picture

I was having the same problem. That fix also worked for me.

Thanks,
Dave

anou’s picture

YES !!!

Thanks. Worked for me too.

olmyr’s picture

Thanks for the fix

berenddeboer’s picture

Status: Active » Closed (fixed)

Committed.

pfrenssen’s picture

For people who want to apply this patch: the commit is c822f5c - link to patch.

NaX’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Closed (fixed) » Active

Can we see this back ported to Drupal 6?

dydave’s picture

Status: Active » Fixed

Hi NaX,

Thanks a lot for getting back to this issue and requesting for a backport to 6.x.
I assume this is probably something that should have been done a while ago.

In any case, I went ahead, got the patch backported and committed against the 6.x-1.x branch at c443468.

I allowed myself to mark this issue as fixed for now, but feel free to re-open it, or post a new ticket, at any time if you have any further objections or encounter any issues with the commit c443468 (we would surely be happy to hear your feedback).

Please let me know if you would have any further comments, feedback, questions, issues, objections, suggestions or concerns on any aspects in the commits or this ticket in general, I would be glad to provide more information or explain in more details.

Thanks again to everyone for your help, reviews, feedback and comments on this issue.
Cheers!

Status: Fixed » Closed (fixed)

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