You are here

function cheeseburger_menu_update_8001 in Cheeseburger Menu 5.0.x

Same name and namespace in other branches
  1. 8.4 cheeseburger_menu.install \cheeseburger_menu_update_8001()

Implements hook_update_N().

File

./cheeseburger_menu.install, line 17

Code

function cheeseburger_menu_update_8001(&$sandbox) {
  $cheeseburger_blocks = \Drupal::entityTypeManager()
    ->getStorage('block')
    ->loadByProperties([
    'plugin' => 'cheeseburger_menu',
  ]);
  foreach ($cheeseburger_blocks as $cheeseburger_block) {
    $settings = $cheeseburger_block
      ->get('settings');
    foreach ($settings['menus'] as $key => $menu) {
      $settings['menus'][$key]['settings']['collapsible_title'] = FALSE;
      $settings['menus'][$key]['settings']['title_default_expanded'] = TRUE;
    }
    $cheeseburger_block
      ->set('settings', $settings);
    $cheeseburger_block
      ->save();
  }
}