Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Thanks for this great module.
I have used this module before but I did not encounter this issue as I am having a different set up now.
I have 4 languages in the system, DE/FR/IT/EN with EN being disabled. When creating a new translatable content (product) the language selector shows all 4 languages including EN which is disabled.
This allows users to create content in a disabled language even though they do not have the appropriate permission granted.
Comment | File | Size | Author |
---|---|---|---|
#5 | disable_language-disable_lang_node_edit_form-3032728-5.patch | 1.72 KB | sandboxpl |
#4 | disable_language-disable_lang_node_edit_form-3032728-3.patch | 1.43 KB | brentg |
Comments
Comment #2
mstiComment #3
nielsaers CreditAttribution: nielsaers as a volunteer and for Dropsolid commentedI've been kinda busy lately, but i'm happy to review and accept a patch.
If I find some time i'll look into it.
Comment #4
brentgWorked a bit on this issue on drupaljam, but was not able to finish this.
In my opinion we'll need a custom permission for this, because in some cases the module can be used to disable a language where the content is being created, and in that case you'll need to be able to create content in a disabled language.
Done:
- Created custom permissions
- Started on writing a custom widget alter with permisson check
TODO:
- Disable the languages in the edit form.
Notes:
I tried with a form alter and field_widget_alter, but it seems that it's not a standard select list, but something special for the languages, so I don't know if you can easily remove items from the select list
Comment #5
sandboxplThere is a way to alter language_select widget options, but as there's lot of processing going on, those options are available bit late,
dealing with it in #after_build callback does the job
Comment #6
michaelvanh CreditAttribution: michaelvanh commentedHello sandboxpl i tested your patch in #5 and it seems to work well. Another thing to consider could be: When on a node edit form you click the 'translate' tab. All languages are still visible including the disabled ones, maybe these should be hidden? The 'add' link does redirect however.
Comment #7
bserem CreditAttribution: bserem at zehnplus commentedPatch #5 doesn't work for me. I see the permission, but the select widget continues to display all languages even for people without the permission.UPDATE:
Patch #5 works for me on a new test environment a created locally.
Comment #8
bserem CreditAttribution: bserem at zehnplus commentedComment #9
bserem CreditAttribution: bserem at zehnplus commentedComment #10
sandboxplComment #11
sandboxpl@michaelvanh altering content translation tables is a tricky thing, I think it should be reviewed and executed in a separate issue, I've created new one for that: https://www.drupal.org/project/disable_language/issues/3091554
Comment #13
sandboxplreviewed and committed do dev,
thanks for providing code and testing this one !