Skip to content
Snippets Groups Projects
Commit aa79c93b authored by Aaron Bauman's avatar Aaron Bauman
Browse files

Add 'no auth providers' message when plugins are missing

parent d94d0062
No related branches found
No related tags found
No related merge requests found
......@@ -140,11 +140,13 @@ class SalesforceAuthConfig extends ConfigEntityBase implements EntityInterface {
* The list of plugins, indexed by ID.
*/
public function getPluginsAsOptions() {
$options = ['' => t('- Select -')];
foreach ($this->authManager()->getDefinitions() as $id => $definition) {
$options[$id] = ($definition['label']);
}
return $options;
if (!empty($options)) {
return ['' => t('- Select -')] + $options;
}
return [];
}
}
......@@ -22,6 +22,11 @@ class SalesforceAuthForm extends EntityForm {
*/
public function form(array $form, FormStateInterface $form_state) {
$auth = $this->entity;
if (empty($auth->getPluginsAsOptions())) {
$this->messenger()->addError('No auth provider plugins found. Please enable an auth provider module, e.g. salesforce_jwt, before adding an auth config.');
$form['#access'] = FALSE;
return $form;
}
$form_state->setBuildInfo($form_state->getBuildInfo()
+ ['auth_config' => $this->config($auth->getConfigDependencyName())]);
$form['label'] = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment