billwerk_subscriptions-1.x-dev/modules/billwerk_subscriptions_manage/billwerk_subscriptions_manage.install

modules/billwerk_subscriptions_manage/billwerk_subscriptions_manage.install
<?php

/**
 * @file
 * The install file.
 *
 * Install, update and uninstall functions for the billwerk_subscriptions_manage
 * module.
 */

/**
 * Added new billwerk_subscriptions_manage.helper service.
 */
function billwerk_subscriptions_manage_update_10001(&$sandbox) {
  // Empty update hook to rebuild services.
}

/**
 * Set default message texts, if empty.
 */
function billwerk_subscriptions_manage_update_10002(&$sandbox) {
  $config = \Drupal::configFactory()->getEditable('billwerk_subscriptions_manage.settings');

  // Set empty messages to defaults:
  if (empty($config->get('order_terms.value'))) {
    $config->set('order_terms', [
      'value' => "Your subscription will be activated as soon as we receive your payment.\nA paid subscription incurs recurring fees.\nThe subscription is automatically renewed unless it is canceled within the respective notice period.\nOur general terms and conditions apply.\nWe use your data in accordance with our privacy policy.",
      'format' => 'full_html',
    ]);
  }
  if (!empty($config->get('order_terms_upgrade.value'))) {
    $config->set('order_terms_upgrade', [
      'value' => "Your subscription will be upgraded as soon as we receive your payment.\nA paid subscription incurs recurring fees.\nThe subscription is automatically renewed unless it is canceled within the respective notice period.\nOur general terms and conditions apply.\nWe use your data in accordance with our privacy policy.",
      'format' => 'full_html',
    ]);
  }
  if (!empty($config->get('order_terms_downgrade.value'))) {
    $config->set('order_terms_downgrade', [
      'value' => "Your subscription will be downgraded at the end of your active contract period.\nOur general terms and conditions apply.\nWe use your data in accordance with our privacy policy.",
      'format' => 'full_html',
    ]);
  }
  if (!empty($config->get('subscription_changed_message.value'))) {
    $config->set('subscription_changed_message', [
      'value' => "You will receive an email about the requested changes soon.\nYou can check your subscription plan, status, contact and billing data at any time in your user profile.\nPlease do not hesitate to contact us if you have any questions.",
      'format' => 'full_html',
    ]);
  }
  if (!empty($config->get('subscription_canceled_message.value'))) {
    $config->set('subscription_canceled_message', [
      'value' => "You will receive an email about the requested changes soon.\nYou can check your subscription plan, status, contact and billing data at any time in your user profile.\nPlease do not hesitate to contact us if you have any questions.",
      'format' => 'full_html',
    ]);
  }
  if (!empty($config->get('subscription_cancel_downgrade_message.value'))) {
    $config->set('subscription_cancel_downgrade_message', [
      'value' => "Your subscription will be downgraded to the free basic plan at the end of the contract period.\nProceed to review.",
      'format' => 'full_html',
    ]);
  }
  if (!empty($config->get('subscription_cancel_contract_message.value'))) {
    $config->set('subscription_cancel_contract_message', [
      'value' => "Your subscription will be canceled at the end of the contract period.\nProceed to review.",
      'format' => 'full_html',
    ]);
  }

  $config->save(TRUE);
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc