We have a number of blocks that are stood up with a feature and I am now noticing that their page visibility is blank when I edit a block after the feature has been enabled. Their visibility and locations are correct after enabling the feature, but these paths do not appear when editing the block. The pages are being set in code. 'Show block on specific pages' is also set to 'All pages except those listed' instead of 'Only on the listed pages' as it should in code. I was pretty sure the blocks were showing this information when being edited in the past.

  $theme['views-news-block'] = array(
    'module' => 'views',
    'delta' => 'news-block',
    'theme' => 'seven',
    'status' => 0,
    'weight' => '0',
    'region' => '',
    'custom' => '0',
    'visibility' => '1',
    'pages' => '<front>',
    'title' => '',
    'cache' => -1,
  );
  $theme['views-news-block'] = array(
    'module' => 'views',
    'delta' => 'news-block',
    'theme' => 'boxed',
    'status' => '1',
    'weight' => '0',
    'region' => 'content',
    'custom' => '0',
    'visibility' => '1',
    'pages' => '<front>',
    'title' => '',
    'cache' => -1,
  );
  $theme['views-news-block'] = array(
    'module' => 'views',
    'delta' => 'news-block',
    'theme' => 'standard',
    'status' => '1',
    'weight' => '0',
    'region' => 'content',
    'custom' => '0',
    'visibility' => '1',
    'pages' => '<front>',
    'title' => '',
    'cache' => -1,
  );
  $theme['views-news-block'] = array(
    'module' => 'views',
    'delta' => 'news-block',
    'theme' => 'wide',
    'status' => '1',
    'weight' => '0',
    'region' => 'content',
    'custom' => '0',
    'visibility' => '1',
    'pages' => '<front>',
    'title' => '',
    'cache' => -1,
  );

Comments

vinmassaro’s picture

These are block configs exported as fe_block_settings. I have one custom block being exported as fe_block_boxes and this DOES contain the correct pages when I view its block settings.

vinmassaro’s picture

This still seems to be happening if I export the block settings for a block created by a view, in the same feature that the view is created.

If I add the view in one feature, and stand up its block configurations in another feature afterward, then it works correctly. Thoughts?

vinmassaro’s picture

I am running the latest 7.x-1.x-dev (2012-Dec-31) by the way.

pfrenssen’s picture

Status: Active » Closed (duplicate)

It sounds like the block settings are being reverted before View that creates the blocks exists. I have encountered similar problems when using Features with components that depend on other components. If you are deploying your new features using update hooks you could manually specify the components to revert in the right order:

function MYMODULE_update_70xx() {
  // Revert the views that create the blocks first.
  features_revert(array('my_feature' => array('views_view')));

  // Revert the blocks settings now that the blocks exist.
  features_revert(array('my_feature' => array('fe_block_settings')));
}

This should help you for now, but we should find a permanent solution, we could update the module weight of FE Block so it runs after the modules that define blocks. There is already an issue for this, so I'm marking this as a duplicate. See #747128: Be sure the modules are running after their dependencies.

vinmassaro’s picture

@pfrenssen: FWIW, I can't the code in #4 to work as documented here.