Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I've recently tried to use Features Extra module to export and import blocks between 2 sites. I found that one of the functions is calling the _block_rehash function. Features extra did the box import ok, but the block settings weren't imported properly. I found that if I modify
// Add defaults and save it into the database.
drupal_write_record('blocks', $block);
// Set region to none if not enabled.
$block['region'] = $block['status'] ? $block['region'] : BLOCK_REGION_NONE;
To:
// Set region to none if not enabled.
$block['region'] = $block['status'] ? $block['region'] : BLOCK_REGION_NONE;
// Add defaults and save it into the database.
drupal_write_record('blocks', $block);
it works. Please let me know if I'm incorrect but I see no reason to save the block to the database before setting additional information.
Thanks
Rob
Comments