You are here

function easy_breadcrumb_update_8002 in Easy Breadcrumb 8

Same name and namespace in other branches
  1. 2.x easy_breadcrumb.install \easy_breadcrumb_update_8002()

Implements hook_update().

Update home_segment_keep config from integer to boolean.

File

./easy_breadcrumb.install, line 25
Add installation messages to help users get started and update.

Code

function easy_breadcrumb_update_8002() {
  $config = \Drupal::configFactory()
    ->getEditable(EasyBreadcrumbConstants::MODULE_SETTINGS);
  $home_segment_keep = $config
    ->get(EasyBreadcrumbConstants::HOME_SEGMENT_KEEP);

  // If the setting is enabled, store it as TRUE.
  if ($home_segment_keep === 1) {
    $config
      ->set(EasyBreadcrumbConstants::HOME_SEGMENT_KEEP, TRUE);
  }
  else {
    $config
      ->set(EasyBreadcrumbConstants::HOME_SEGMENT_KEEP, FALSE);
  }
  $config
    ->save();
}