You are here

social_auth_facebook.install in Social Auth Facebook 8

Same filename and directory in other branches
  1. 8.2 social_auth_facebook.install
  2. 3.x social_auth_facebook.install

Install, update, and uninstall functions for the Social Auth Facebook module.

File

social_auth_facebook.install
View source
<?php

/**
 * @file
 * Install, update, and uninstall functions for the Social Auth Facebook module.
 */
use Drupal\social_api\Utility\SocialApiImplementerInstaller;
use Drupal\social_auth\Controller\SocialAuthController;

/**
 * Implements hook_requirements().
 *
 * Checks that a compatible version of Facebook Graph SDK has been installed
 * with Composer. Check installation instructions from the README.txt.
 */
function social_auth_facebook_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_facebook', 'Social Auth Facebook', 'facebook/graph-sdk', 5.0, 6.0);
  }
  return $requirements;
}

/**
 * Implements hook_install().
 */
function social_auth_facebook_install() {
  SocialAuthController::setLoginButtonSettings('social_auth_facebook', 'social_auth_facebook.redirect_to_fb', 'img/facebook_logo.svg');
}

/**
 * Implements hook_uninstall().
 */
function social_auth_facebook_uninstall() {
  SocialAuthController::deleteLoginButtonSettings('social_auth_facebook');
}