acquia_lift-8.x-4.3/acquia_lift.install

acquia_lift.install
<?php

/**
 * @file
 * Install, update, and uninstall functions for the Acquia Lift module.
 */

use Drupal\acquia_lift\Service\Helper\SettingsHelper;
use Drupal\Core\Url;

/**
 * Implements hook_requirements().
 */
function acquia_lift_requirements($phase) {
  $requirements = [];

  if ($phase !== 'runtime') {
    return $requirements;
  }

  $credentialSettings = \Drupal::config('acquia_lift.settings')->get('credential') ?? [];
  if (!SettingsHelper::isInvalidCredential($credentialSettings)) {
    return $requirements;
  }

  $requirements['acquia_lift_credential'] = [
    'title' => t('Acquia Lift module'),
    'description' => t('Acquia Lift module has not been fully configured yet. Please configure its settings from the <a href=":url">Acquia Lift Settings page</a>.', [':url' => Url::fromRoute('acquia_lift.admin_settings_form')->toString()]),
    'severity' => REQUIREMENT_WARNING,
    'value' => t('Incomplete or invalid credential'),
  ];

  return $requirements;
}

/**
 * Remove deprecated configuration and update content replacement mode.
 */
function acquia_lift_update_8400() {
  $config = Drupal::configFactory()->getEditable('acquia_lift.settings');

  // Remove stored values of authentication url and content origin.
  $config->clear('credential.oauth_url');
  $config->clear('credential.content_origin');

  // Save trusted mode for sites having the deprecated untrusted mode set.
  if ($config->get('advanced.content_replacement_mode') == 'untrusted') {
    $config->set('advanced.content_replacement_mode', 'trusted');
  }

  $config->save();
}

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

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