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.
Hello,
Amazing simple module.
In my case I want to prevent some roles from selecting the node language on node create untill they have permission to that.
Comments
Comment #1
m.abdulqader CreditAttribution: m.abdulqader commentedI created a patch to do the following:
Comment #2
m.abdulqader CreditAttribution: m.abdulqader commentedComment #3
m.abdulqader CreditAttribution: m.abdulqader commentedComment #4
hhschoone CreditAttribution: hhschoone commentedHi!
This module combined with your patch is almost exactly what I'm looking for! The only thing is: I want editors to be able to select only the languages I give them permission to. Your patch allows for selecting the default language by default. Is there any reason for that behaviour? (Admittedly, I need to check the site's language-setup, but that's for another time)
Thanks!
Comment #5
m.abdulqader CreditAttribution: m.abdulqader commentedChange the settings of your content type to require langugage selection so it will disappear :)
Comment #6
hhschoone CreditAttribution: hhschoone commentedI have done that: under the tab 'Multilingual settings' I've selected the 'Require Language' option. However, your form_alter-code excludes both the 'und' (which isn't shown due to the Require Language-option) and default languages from unsetting:
If I remove the 2nd part (
&& $lang != $default_language->language
) it won't show the default language when the user is not given permission. Is there any reason for that line of code (i.e. does the default site-language always need to be selectable for it to work correctly)?Edit: In the case of removing that line of code it is essential to check at least one language in the permissions. If not, no content can be created...
Comment #7
hhschoone CreditAttribution: hhschoone commentedComment #8
m.abdulqader CreditAttribution: m.abdulqader commentedI see, this is important for viewing at least one language which in our case was the default language.
Thank you :)
Comment #9
m.abdulqader CreditAttribution: m.abdulqader commentedI updated the und issue to use the constant variable :) and update the patch with the new release published today.
Comment #10
Jānis Bebrītis CreditAttribution: Jānis Bebrītis commentedit was necessary to allow default language to avoid extra loops for checking if "any" language is available. Users were redirected when they had no access to language, but having no languages available led to redirect loops.
Yesterday we changed it from drupal_goto to drupal_access_denied.
Comment #11
m.abdulqader CreditAttribution: m.abdulqader commentedYes I noticed that in last commit, but in our case we are remove languages from node add form, so you can arrange who can add a language depend on his role.
I remove the un used variable default language.
Patch attached.
Comment #14
m.abdulqader CreditAttribution: m.abdulqader commentedFYI
Advanced patch contributor guide
https://www.drupal.org/node/1054616
Comment #15
m.abdulqader CreditAttribution: m.abdulqader commentedComment #16
m.abdulqader CreditAttribution: m.abdulqader commentedComment #19
erdm CreditAttribution: erdm commentedThanks M.Abdulqader .
What about patch for drupal 9/10 or custom entity other than node types... Any plan ?