social_auth_steemconnect-8.x-2.x-dev/social_auth_steemconnect.install

social_auth_steemconnect.install
<?php

/**
 * @file
 * Install file for the Social Auth Steemconnect module.
 */

use Drupal\social_api\Utility\SocialApiImplementerInstaller;
use Drupal\social_auth\Controller\SocialAuthController;

/**
 * Implements hook_requirements().
 *
 * Checks that a compatible version of oAuth2 Steemconnect library for the
 * league OAuth2 client with Composer. Check installation instructions
 * from the README.md.
 */
function social_auth_steemconnect_requirements($phase) {

  $requirements = [];

  // Social API should be installed at this point in order to check library.
  \Drupal::service('module_installer')->install(['social_api']);

  if ($phase == 'install') {
    $requirements = SocialApiImplementerInstaller::checkLibrary('social_auth_steemconnect', 'Social Auth Steemconnect', 'guix77/oauth2-steemconnect', 2.0, 3.0);
  }

  return $requirements;

}

/**
 * Implements hook_install().
 */
function social_auth_steemconnect_install() {
  SocialAuthController::setLoginButtonSettings('social_auth_steemconnect', 'social_auth_steemconnect.redirect_to_steemconnect', 'img/steemconnect_logo.svg');
}

/**
 * Implements hook_uninstall().
 */
function social_auth_steemconnect_uninstall() {
  SocialAuthController::deleteLoginButtonSettings('social_auth_steemconnect');
}

/**
 * Implements hook_update_N().
 *
 * The key api_calls was changed to endpoints. This update copies the values
 * in 'api_calls' to 'endpoints'.
 */
function social_auth_steemconnect_update_8201(&$sandbox) {
  $config = \Drupal::configFactory()->getEditable('social_auth_steemconnect.settings');
  $endpoints = $config->get('api_calls');

  $config->set('endpoints', $endpoints)->save();
}

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

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