public function OpenIDConnectLoginForm::buildForm in OpenID Connect / OAuth client 2.x
Same name and namespace in other branches
- 8 src/Form/OpenIDConnectLoginForm.php \Drupal\openid_connect\Form\OpenIDConnectLoginForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ OpenIDConnectLoginForm.php, line 77
Class
- OpenIDConnectLoginForm
- Provides the OpenID Connect login form.
Namespace
Drupal\openid_connect\FormCode
public function buildForm(array $form, FormStateInterface $form_state) : array {
$clients = $this->entityTypeManager
->getStorage('openid_connect_client')
->loadByProperties([
'status' => TRUE,
]);
foreach ($clients as $client_id => $client) {
/** @var \Drupal\openid_connect\OpenIDConnectClientEntityInterface $client */
$form['openid_connect_client_' . $client_id . '_login'] = [
'#type' => 'submit',
'#value' => $this
->t('Log in with @client_title', [
'@client_title' => $client
->label(),
]),
'#name' => $client_id,
'#prefix' => '<div>',
'#suffix' => '</div>',
];
}
return $form;
}