Hi,

I've ported this module to Drupal 7. I've also rewritten function languagepath to use standard Drupal API and reviewed coding standards with coder module.

Here's a patch against current master branch. If you apply it on official release, you must clean .info file manually.

Please verify it and commit to repository.

This patch is sponsored by FreeFox.

Comments

idflood’s picture

Patch looks good, and seems to be working pretty well. There was 3 trailing whitespace issue so i only edited the patch to fix them.

FreeFox’s picture

Status: Needs review » Reviewed & tested by the community

I installed it on 2 sites now and it works perfectly. Please create a D7 version of it.

Thanks to lklimek for the good job.

PixelClever’s picture

Status: Reviewed & tested by the community » Needs review

There is now a D7 dev release. I haven't had time to test, but if people run it for a while and it seems stable we'll make it an official release.

acp’s picture

Version: 6.x-3.6 » 7.x-1.x-dev

Hello,

the module does not work at all in D7. You should apply the patch (which worked, albeit not without its warning messages on its administration panel) because many things seem to have changed in core since the 6.x series.

Thanks!

ChoY’s picture

can confirm: The module don't work on d7 - no problem to install configuration provoque various fatal error messages with site crash …

FreeFox’s picture

I confirm this problem. The downloadable 7 version has still the info file of 6 so I guess a wrong version in uploaded.

When you take the latest 6 version and patch it with patch in #1 it works fine for me.

I noticed 1 more thing: even after te patch, in line 4 of the .module it reads "Creates a language switcher for Drupal 6". I guess it's best to change that with "Creates a language switcher for Drupal" so it will be ok for all versions.

lklimek’s picture

It seems that patch was applied on "master" branch instead of 7.x-1.x

Aaron Hawkins: you should merge changes from master to 7.x-1.x, eg:

git checkout master
git checkout 7.x-1.x
git merge master
git push

I would do it myself, but I don't have RW access to repository :(.

idflood’s picture

Ok, I had a strange bugs since I enabled this module on one site ( update.php not accessible, fields from display suite beeing visible/hidden randomly... ). One of the thing that bring light to this bug was that doing a "cache clear" from the drupal UI was ok, bug regular cron and "drush cc all" always led to invisible display suite fields.

So, I added a little check at the top of languageinterface.module to not redirect if we are accessing update.php or cron.php.

if (variable_get('language_redirect', 0) == 1) {
  $script_name = $_SERVER['REQUEST_URI'];
  if (strpos($script_name, "update.php") !== 0 || strpos($script_name, "cron.php") !== 0) {
    return;
  }
  ...

Attached is a patch against the current 7.x branch ( also fix the "drupal 6" discovered by FreeFox in #6 )

idflood’s picture

above patch has a wrong condition, should be !== FALSE. new patch attached

idflood’s picture

Title: Drupal 7 Port » languageinterface: Drupal 7 Port
FileSize
22.1 KB

I still had strange issues and found there was still some "undefined variable" errors. I fixed them by adding one more conditional return at the top of languageinterface.module

if (!isset($_SERVER['QUERY_STRING']) || !isset($_SESSION)) {
    return;
  }

Here is a patch against the 7.x branch

idflood’s picture

I just discovered one another issue. The node_load function wasn't accessible in languagepath function so I added this:

// load node module
module_load_include('module', 'node', 'node');

I hope it was the last critical error, the module is running smoothly now.

lklimek’s picture

Hi,

I've committed #11 to 7.x-1.x branch. It should be released as new devel snapshot soon.
Please review the release and create all new patches against current 7.x-1.x tree.

lklimek’s picture

Assigned: Unassigned » lklimek
Status: Needs review » Fixed

Code in repository. Please test it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.