public static function Oauth2ClientPluginConfigForm::create in OAuth2 Client 8.3
Instantiates a new instance of this class.
This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.
Parameters
\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.
Overrides FormBase::create
File
- src/
Form/ Oauth2ClientPluginConfigForm.php, line 47
Class
- Oauth2ClientPluginConfigForm
- Configure OAuth2 Client settings for this site.
Namespace
Drupal\oauth2_client\FormCode
public static function create(ContainerInterface $container) {
$instance = parent::create($container);
$routeMatch = $instance
->getRouteMatch();
$pluginId = $routeMatch
->getParameter('plugin');
/** @var \Drupal\oauth2_client\PluginManager\Oauth2ClientPluginManager $pluginManager */
$pluginManager = $container
->get('oauth2_client.plugin_manager');
$config = $instance
->configFactory()
->get('oauth2_client.credentials.' . $pluginId)
->getRawData();
$instance->plugin = $pluginManager
->createInstance($pluginId, $config);
$instance->state = $container
->get('state');
$instance->clientService = $container
->get('oauth2_client.service');
$instance->messenger = $container
->get('messenger');
return $instance;
}