In porting Facebook Page Plugin I'd like to create a upgrade path from D7 to Backdrop. In D7, they used variables for the settings (e.g. variable_get('fb_likebox_url', '')), and since in D7 blocks can (by default) only have one instance, that makes sense. However in Backdrop settings for blocks are saved (by default) by the Layout module:

Most settings will automatically be saved if using the Layout module to position blocks...

(source: hook_block_save())

Indeed, I found the settings for my block saved in 'layout.layout.default.json' under 'content > [UUID] > data > settings > block_settings'. This makes sense in Backdrop as blocks can have multiple instances, so storing each block's settings in Layouts works nicely.

The problem is converting Drupal's variables to Backdrop's block settings:

  1. How to know which config file to edit (e.g. where does the block from Drupal get saved in Backdrop when upgrading?)
  2. How to know what the UUID is in order to save the proper config path?

Any help appreciated!

Comments

The upgrade from D7 creates only the Default and the Admin, so your block will be converted to a block in the Default layout. There will be only one instance of the block on converting.

So I guess in 'facebook_page.install' 'facebook_page_update_1000()' you could loop through <default>->content find blocks with delta 'facebook_page' (there'll be only the one) and save the default settings there from the 'update_variable_get()' returns.

Untested advice.