1

i want to create a theme setting to change blocks position(region) for ex.

option_1 block_branding-> region_top block_main_menu-> region_menu

option_2 block_branding-> region_branding block_main_menu-> region_header_first

I think that should do something like:

  • Create a file with a function to change the region of the blocks according to option.
  • Call this function when the form is submitted.

But I don't how to get block info to change its position.

1 Answer 1

1

First of all you should change each desired block region for your theme manually at Administration>Structure>Block layout Tab and then go to the config export function at:
Administration>Configuration>Development>Configuration synchronization>Export Tab>Full archive to export all the block settings for your theme.
Then you should take a look at to the generated YAML files and placed them in a new folder within your theme at /config/install. you then uninstalled the theme and then reinstalled it as the default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.