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.
Unpublished translations are showing up in our dropdown, which leads anonymous users to a 404 page. Idealy these nodes would not appear in the dropdown as they are not ready for public consumption.
We've fixed it by adding the following code:
// Now we iterate on $languages to build the needed options for the select element.
foreach ($languages->links as $lang_code => $lang_options) {
//Patch - start
//this keeps unpublished nodes from showing in the dropdown
if(!empty($lang_options['href'])){
$node = menu_get_item($lang_options['href']);
if($node['map'][1]->status == 0){
continue;
}
}
// end patch
Any chance of a patch?
Thanks! (Lovely little module.)
Comments
Comment #1
manfer CreditAttribution: manfer commentedI'm not able to reproduce your issue. Not published nodes doesn't appear in the language dropdown switcher.
Comment #2
manfer CreditAttribution: manfer commentedNot sure if there were some problem with language negotiation session, none that I know with language negotiation url, but version 7.x-2.1 should solve it if any.
If on the other hand this is related to entity translation then it is just that still there isn't a proper integration of entity translation with the language switchers, not with core language switcher and not with language dropdown switcher. That one would be not a language dropdown switcher issue.
There is another issue about entity translation so I'm going to consider this one as fixed, considering it must not be about entity translation.