SocialAuthLoginBlock.php in Social Auth 8.2
File
src/Plugin/Block/SocialAuthLoginBlock.php
View source
<?php
namespace Drupal\social_auth\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Config\ImmutableConfig;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class SocialAuthLoginBlock extends BlockBase implements ContainerFactoryPluginInterface {
private $socialAuthConfig;
public function __construct(array $configuration, $plugin_id, $plugin_definition, ImmutableConfig $social_auth_config) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->socialAuthConfig = $social_auth_config;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('config.factory')
->get('social_auth.settings'));
}
public function build() {
return [
'#theme' => 'login_with',
'#social_networks' => $this->socialAuthConfig
->get('auth'),
];
}
}