Closed (fixed)
Project:
Social Auth
Version:
8.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Jul 2016 at 19:13 UTC
Updated:
13 Feb 2017 at 16:44 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
gvsoComment #3
felribeiro commentedPlease, review this patch and suggest some improvement.
Comment #4
e0ipsoThanks for the patch @felribeiro. I added some suggestions:
This feels a bit weird. Maybe:
We should allow to redirect back to the page where they started the login process.
Shouldn't we use the regular permissions system instead?
Comment #5
gvsoThanks for the patch!
I think we have not removed this kind of comments in the code yet, but I have seen that it's not longer necessary. Core modules don't have a @file comment in their classes anymore
Should we use SafeMarkup? It is deprecated, so I don't know if it is recommendable to use it
I think we should return only a string, so the child can do something like:
return [
parent::getEditableConfigNames(),
'module.settings'
]
Comment #6
gvsoI agree, we should specify to leave it in blank if site builders want to redirect to where the process started.
Comment #7
gvsoComment #8
gvsoComment #9
denutkarsh commentedOkay, so i fixed the previous patch and added suggestions from comment #4,#5,#6.
Comment #10
gvsoSorry for the last comment. Return an array as most modules do. Implementers will need to do something like
return parent::getEditableConfigNames() + ['module.settings'];The new patch do not include SafeMarkup at the top, but has this code which will produce an error
To test if your form works. You can change the code of the settings form of any implementer (e.g. Social Auth Twitter). Instead of extending ConfigFormBase, you need to extend from the new SocialAuthSettingsForm. Plus, in getEditableConfigName() you should do something like
return parent::getEditableConfigNames() + ['module.settings'];Comment #11
denutkarsh commented@gvso Okay so i have made this patch fixing the issues mentioned in previous comment. I have also tested it on Social Auth Google.
Comment #12
gvsoPlease change 'module_settings' to 'social_auth'
I'd say "Social Auth settings"
Instead, implement an use statement above and don't use (\) before Drupal
I didn't check the functionality yet. I hope you tested if configurations are saved
Comment #13
gvsoComment #14
denutkarsh commented@gvso Here is the new patch that fixes all the issues mentioned.
Comment #15
denutkarsh commentedComment #16
denutkarsh commented@gvso After applying this patch, i got the this error while configuring the settings.
[13-Jan-2017 05:58:50 Europe/Berlin] Uncaught PHP Exception Drupal\Core\Config\ImmutableConfigException: "Can not set values on immutable configuration social_auth_google.settings:client_id. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object" at /Applications/XAMPP/xamppfiles/htdocs/drupalV/drupal-8.2.x/core/lib/Drupal/Core/Config/ImmutableConfig.php line 27So i change changed the submitForm function in GoogleAuthSettingsForm to this
It started working after that.
Comment #17
denutkarsh commentedUsing
return array_merge(parent::getEditableConfigNames(), array('social_auth_google.settings'));instead of+operator ingetEditableConfigNames()solved the issue mentioned above. After this we don't need to use the method mentioned above, it has mutable configuration now.Comment #18
gvsoThanks @denutkarsh,
We will need a schema.yml file and use true/false instead of 1/0
Since these are new settings added, we'll need to add a hook_update_n() function for sites which update the module and add the same values as default.
Sort them alphabetically
Comment #19
gvsoAlso, we need to update https://github.com/drupalsocialinitiative/social_api_examples/tree/8.x-1.x/social_auth_example after patch is commited
Comment #20
denutkarsh commentedHere is the new patch.
Comment #21
gvsoThanks for the patch. We are almost there.
We should change these two to true and false values
As a consequence of the previous change, they will be "boolean" type
Because $this is returned in set method, we can do something like
$config->set($key1, $value1)
->set($key2, $value2)
->save();
Comment #22
denutkarsh commented@gvso I forgot about the first suggestion, i thought i implemented it in the new patch. Anyways here is the new patch
Comment #24
gvsoThanks! I've committed the patch with some changes
Sorry, I didn't notice this hook was created in social_auth.module. I moved it to social_auth.install
For coding standards, the last 3 set() and the save() methods has to be indented with only 2 spaces more than $config
It seems we can now focus on #2821853: Provide Social Auth settings: functionality
Comment #25
hussainwebI am a little confused here. How do I access this form? I don't see anything in routing.yml or links files or anything in the patch that links it to any of the existing routes.
Comment #26
denutkarsh commented@hussainweb After this issue was fixed implementers can implement this form by extending SocialAuthSettingsForm. See #10 for more information https://www.drupal.org/node/2763757#comment-11865493
Comment #27
denutkarsh commented@gvso Do you think we should implement this functionality right now in implementers or should we do it after this issue is fixed https://www.drupal.org/node/2821853 ?
Comment #28
hussainwebThanks! I didn't see this in Google Auth module and was confused. This might be useful but I can wait for this.
Comment #29
gvso@denutkarsh, I think it's better to fix #2821853: Provide Social Auth settings: functionality first, so site builders don't get confused if their settings don't work