I just figured out how to remove a block: https://forum.backdropcms.org/forum/how-remove-block-layout-during-install
Now, I'm trying to place a block. There are two things that must happen:
- I have to define the block in the layout.layout.dashboard.json file
- I have to place the block in the correct region in the same file.
I can place the block with something like this:
config_set('layout.layout.dashboard','positions.half1', array('e44a8a0c-7179-4e1f-b505-5b9d32823a4f, 8ebebe78-4aa4-4d08-a79f-2463daf79863, f149b0ac-ff4c-46f5-8402-ee1aac572dfb'));
Right now, I am having trouble defining the block. I tried this, but it got an error: "syntax error, unexpected ‘$block’ (T_VARIABLE)"
$uuid = 'e44a8a0c-7179-4e1f-b505-5b9d32823a4f'; $block = array( 'plugin' => 'dashboard_plus:manage_content', 'data' => array( 'module' => 'dashboard_plus', 'delta' => 'manage_content', 'settings' => array( 'title_display' => 'default', 'title' => '', 'style' => 'default', 'block_settings' => array( ), 'contexts' => array(), ), 'uuid' => $uuid, 'style' => array( 'plugin' => 'default', 'data' => array( 'settings' => array( 'classes' => '', ), ), ), ), ); config_set('layout.layout.dashboard', "content.$uuid", $block);
How can I fix this?
I got it. The following adds a block from the dashboard plus module to the dashboard layout.
I believe that there were a couple of problems with the first iteration of the code.