Hi!
Thank You for module!
I save the block and settings of the block with the feature, but after I enable it doesn't create block. It create block only when I revert it.
Also I get that error message:

Notice: Undefined index: BLOCK_MACHINE_NAME in fe_block_boxes_features_export_render() (line 233 of /var/www/html/sites/all/modules/features_extra/fe_block.module).
Notice: Trying to get property of non-object in _fe_block_get_bid() (line 443 of /var/www/html/sites/all/modules/features_extra/fe_block.module).

If someone knows what's going on, please help.
One more Thanks!

CommentFileSizeAuthor
#5 undefined_index-1225524-5.patch3.33 KBguillaumev

Comments

sitron2’s picture

hi!
i'm experiencing the same problem. did you find any solution?

wizonesolutions’s picture

I think this is known, but in the end it does work, correct? Is the error message the only issue?

pau1_m’s picture

subscribing

mrryanjohnston’s picture

#2 No, in the end, it does not work.

guillaumev’s picture

Status: Active » Needs review
StatusFileSize
new3.33 KB

Here is a patch which fixes the issues.

pfrenssen’s picture

Wow the patch in #5 seems to fix a lot more than just the 'undefined index' error.

pfrenssen’s picture

Status: Needs review » Needs work

Patch in #5 needs work:

  • Reuse fe_block_settings_features_revert() and fe_block_boxes_features_revert() instead of duplicating code.
  • It is not clear to me why this code is used instead of drupal_write_record(), it seems to do the exact same thing?
    +        $fields = $block;
    +        if (isset($fields['machine_name'])) {
    +          unset($fields['machine_name']);
    +        }
    +        db_merge('block')
    +          ->key(array('module' => $block['module'], 'delta' => $block['delta'], 'theme' => $custom_theme))
    +          ->fields($fields)
    +          ->execute();
    
pfrenssen’s picture

Here's the fix I used in my sandbox to get rid of the notice:

diff --git a/fe_block.module b/fe_block.module
index d62baa5..9c3b1c1 100644
--- a/fe_block.module
+++ b/fe_block.module
@@ -201,6 +201,9 @@ function fe_block_settings_features_revert($module_name = NULL) {
   global $custom_theme, $theme_key;
   $component = 'fe_block_settings';
   $defaults = features_get_default($component, $module_name);
+  if (empty($defaults)) {
+    return;
+  }
 
   // Provide backwards compatibility with the old export format that only
   // supported theme specific settings.

Refs:

pfrenssen’s picture

I split up Guillaume's patch into the 3 different problems it actually addresses and committed them to my sandbox:

I'm working in this sandbox because I urgently need to get some features and bugfixes in Features Extra before a deadline later this week. I lack the time to reroll all patches properly to the current 7.x-1.x.

I hope that this sandbox can be merged in with the main project after approval by the maintainers.

pfrenssen’s picture

Status: Needs work » Needs review

Status: Fixed » Closed (fixed)

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