braintree_cashier-8.x-4.x-dev/braintree_cashier.install

braintree_cashier.install
<?php

/**
 * @file
 * Install, update and uninstall functions for the Braintree Cashier module.
 */

/**
 * {@inheritdoc}
 */
function braintree_cashier_requirements($phase) {
  $requirements = [];

  if ($phase == 'update') {
    $entity_update_manager = \Drupal::entityDefinitionUpdateManager();

    $target_type_map = [
      'billing_plan' => 'braintree_cashier_billing_plan',
      'discount' => 'braintree_cashier_discount',
      'subscription' => 'braintree_cashier_subscription',
    ];

    $entity_types = $entity_update_manager->getEntityTypes();

    $old_types_exist = FALSE;
    foreach (array_keys($target_type_map) as $old_entity_type) {
      if (in_array($old_entity_type, array_keys($entity_types))) {
        $old_types_exist = TRUE;
      }
    }
    if ($old_types_exist) {
      $requirements['braintree_cashier_old_entity_types_detected'] = [
        'title' => 'Old entity types detected.',
        'description' => 'Please update to the latest 8.x-3.0 version of Braintree Cashier and manually uninstall the old entity types before updating to 4.x. Please see the 8.x-3.0 release notes for instructions.',
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }

  return $requirements;
}

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

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