You are here

class SocialAuthController in Social Auth 8.2

Same name and namespace in other branches
  1. 8 src/Controller/SocialAuthController.php \Drupal\social_auth\Controller\SocialAuthController
  2. 3.x src/Controller/SocialAuthController.php \Drupal\social_auth\Controller\SocialAuthController

Manages login buttons settings and integration table renderization.

Hierarchy

  • class \Drupal\social_auth\Controller\SocialAuthController extends \Drupal\social_api\Controller\SocialApiController

Expanded class hierarchy of SocialAuthController

File

src/Controller/SocialAuthController.php, line 10

Namespace

Drupal\social_auth\Controller
View source
class SocialAuthController extends SocialApiController {

  /**
   * Sets the settings for the login button for the given social networking.
   *
   * @param string $module
   *   The module machine name.
   * @param string $route
   *   The route name of the user authentication controller.
   * @param string $img_path
   *   The path of the image for login.
   */
  public static function setLoginButtonSettings($module, $route, $img_path) {
    $config = \Drupal::configFactory()
      ->getEditable('social_auth.settings');
    $img_path = drupal_get_path('module', $module) . '/' . $img_path;
    $config
      ->set('auth.' . $module . '.route', $route)
      ->set('auth.' . $module . '.img_path', $img_path)
      ->save();
  }

  /**
   * Delete the settings for the login button for the given social networking.
   *
   * @param string $module
   *   The module machine name.
   */
  public static function deleteLoginButtonSettings($module) {
    $config = \Drupal::configFactory()
      ->getEditable('social_auth.settings');
    $config
      ->clear('auth.' . $module)
      ->save();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SocialAuthController::deleteLoginButtonSettings public static function Delete the settings for the login button for the given social networking.
SocialAuthController::setLoginButtonSettings public static function Sets the settings for the login button for the given social networking.