You are here

agreement.post_update.php in Agreement 3.0.x

Same filename and directory in other branches
  1. 8.2 agreement.post_update.php

Agreement module post-updates.

File

agreement.post_update.php
View source
<?php

/**
 * @file
 * Agreement module post-updates.
 */
use Drupal\Core\Config\Entity\ConfigEntityUpdater;

/**
 * Fixes translatable schema types from "string" to "label".
 */
function agreement_post_update_fix_translatable_schema(&$sandbox = NULL) {
  if (\Drupal::moduleHandler()
    ->moduleExists('agreement')) {

    // Saving each agreement should be enough.
    \Drupal::classResolver(ConfigEntityUpdater::class)
      ->update($sandbox, 'agreement');
    return t('Updated all agreements.');
  }
  return NULL;
}

/**
 * Changes frequency type from "integer" to "float".
 */
function agreement_post_update_update_frequency_type(&$sandbox = NULL) {
  if (\Drupal::moduleHandler()
    ->moduleExists('agreement')) {
    \Drupal::classResolver(ConfigEntityUpdater::class)
      ->update($sandbox, 'agreement');
    return t('Updated all agreements');
  }
  return NULL;
}

Functions

Namesort descending Description
agreement_post_update_fix_translatable_schema Fixes translatable schema types from "string" to "label".
agreement_post_update_update_frequency_type Changes frequency type from "integer" to "float".