You are here

function modal_page_update_40007 in Modal 4.0.x

Same name and namespace in other branches
  1. 4.1.x modal_page.install \modal_page_update_40007()

Adds a new settings item with default value.

File

./modal_page.install, line 515
Install, update and uninstall functions for the Modal Page.

Code

function modal_page_update_40007() {
  $config = \Drupal::configFactory()
    ->getEditable('modal_page.settings');

  // Set load_bootstrap_cdn as TRUE by default.
  $config
    ->set('load_bootstrap_cdn', TRUE);

  // Save.
  $config
    ->save();

  // If do you have option to don't load, so set the new item as FALSE.
  $dontLoadModalPageExternalJs = $config
    ->get('no_modal_page_external_js');
  if (!empty($dontLoadModalPageExternalJs)) {
    $config
      ->set('load_bootstrap_cdn', FALSE);
    $config
      ->save();
  }
}