You are here

function domain_menus_update_8101 in Domain Menus for Domains 9.x

Same name and namespace in other branches
  1. 3.x domain_menus.install \domain_menus_update_8101()
  2. 9.1.x domain_menus.install \domain_menus_update_8101()

Apply htmlspecialchars_decode() to domain menu labels. Versions prior to 8.x-1.0-alpha6 saved menu labels with special char encoding and causes undesired output.

File

./domain_menus.install, line 50
Install, update, and uninstall functions for the Domain Menus module.

Code

function domain_menus_update_8101() {
  $domains = \Drupal::entityTypeManager()
    ->getStorage('domain')
    ->loadMultiple();
  $menus = \Drupal::entityTypeManager()
    ->getStorage('menu')
    ->loadMultiple();
  foreach ($menus as $menu) {
    $menu_domains = $menu
      ->getThirdPartySetting("domain_menus", "domains");
    if ($menu_domains !== NULL) {
      $menu
        ->set('label', htmlspecialchars_decode($menu
        ->get('label'), ENT_QUOTES));
      $menu
        ->save();
    }
  }
}