You are here

function modal_page_update_400011 in Modal 4.0.x

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

Update the Top Right Label Button and Enable Right Button with Default Value.

File

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

Code

function modal_page_update_400011() {
  $config = \Drupal::configFactory()
    ->getEditable('modal_page.settings');
  $config
    ->set('clear_caches_on_modal_save', 1);
  $config
    ->save();

  // Load all Modals.
  $modals = \Drupal::entityTypeManager()
    ->getStorage('modal')
    ->loadMultiple();
  foreach ($modals as $modal) {

    // Set Enable Right Button.
    $modal
      ->setEnableRightButton(TRUE);

    // Store the new value.
    $modal
      ->setTopRightButtonLabel('x');

    // Modal Save.
    $modal
      ->save();
  }
}