You are here

hierarchical_taxonomy_menu.install in Hierarchical Taxonomy Menu 8

Installation file for Hierarchical Taxonomy Menu module.

File

hierarchical_taxonomy_menu.install
View source
<?php

/**
 * @file
 * Installation file for Hierarchical Taxonomy Menu module.
 */

/**
 * Convert config values.
 */
function hierarchical_taxonomy_menu_update_8001() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('block.block.hierarchicaltaxonomymenu') as $block_config_name) {
    $block = $config_factory
      ->getEditable($block_config_name);
    $settings = $block
      ->get('settings');
    $settings['collapsible'] = (bool) $settings['collapsible'];
    $settings['interactive_parent'] = (bool) $settings['interactive_parent'];
    $settings['dynamic_base_term'] = (bool) $settings['dynamic_base_term'];
    $block
      ->set('settings', $settings);
    $block
      ->save();
  }
}

/**
 * Convert show_count config values from bool to integer.
 */
function hierarchical_taxonomy_menu_update_8002() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('block.block.hierarchicaltaxonomymenu') as $block_config_name) {
    $block = $config_factory
      ->getEditable($block_config_name);
    $settings = $block
      ->get('settings');
    $settings['show_count'] = (int) $settings['show_count'];
    $block
      ->set('settings', $settings);
    $block
      ->save();
  }
}

Functions

Namesort descending Description
hierarchical_taxonomy_menu_update_8001 Convert config values.
hierarchical_taxonomy_menu_update_8002 Convert show_count config values from bool to integer.