When exporting

  $export['menu-menu-footer-menu'] = array(
    'cache' => -1,
    'custom' => 0,
    'delta' => 'menu-footer-menu',
    'module' => 'menu',
    'node_types' => array(),
    'pages' => '',
    'roles' => array(),
    'themes' => array(
      'hp_drupal' => array(
        'region' => 'footer',
        'status' => 1,
        'theme' => 'hp_drupal',
        'weight' => -6,
      ),
    ),
    'title' => '<none>',
    'visibility' => 0,
  );

delta works good
but for

  $export['block-footer_back_to_top'] = array(
    'cache' => -1,
    'custom' => 0,
    'machine_name' => 'footer_back_to_top',
    'module' => 'block',
    'node_types' => array(),
    'pages' => '',
    'roles' => array(),
    'themes' => array(
      'hp_drupal' => array(
        'region' => 'footer',
        'status' => 1,
        'theme' => 'hp_drupal',
        'weight' => -5,
      ),
    ),
    'title' => '<none>',
    'visibility' => 0,
  );

delta not exporting and not working...

Comments

scotwith1t’s picture

This is hugely important since many times you will theme a specific block with the id (so #block-block10) and the delta needs to stay the same when the block is exported and imported back in with the feature (in case the theme is also being reused in the feature and has block-specific css). I'm sure there are other reasons to include this info in the export/import features process, but that's my use case...if I can get time, I'll try and dig into the code and see if I can provide a patch...

scotwith1t’s picture

Category: Bug report » Feature request

So, after briefly looking through the code, it looks like you opt for using the machine name that you are required to add to the blocks to export them...I get this now, since if you were not enabling this feature in a new Drupal install, you may have blocks already using those deltas...perhaps there's a compromise to be had though? Maybe store the delta, try and import it using that, but if that delta's already in use, then give it the next available delta for block module's custom blocks? Just an idea. For now, I'm going to just manually manipulate my use case to make it work.

Switching to Feature Request since it seems it's by design that this is the case, but it would really be nice to have the option to keep the deltas.

scotwith1t’s picture

Priority: Major » Normal
rooby’s picture

Another potential possibility is to add the machine name to the block classes array so you can target the block by that class instead.

rschwab’s picture

Just adding that this is a problem for my use case as well. Makes the module unusable with blocks getting different ID's on different servers, and therefore the theming breaks. This definitely seems to me as if it could be a bug, since I imagine most sites will have the same problem (doesn't everyone theme their blocks?).

If I have time later I'll come back and post a fix.

Stevel’s picture

I think adding the delta for custom blocks couldn't possibly work reliably, since you could then have multiple features with blocks, having the same block deltas (e.g. a feature for photo gallery, one for event registrations...). Using the block class module, or creating these blocks in a custom module instead of manually through the UI can help for consistent theming in these cases.