The Move Region module allows you to move the content of a region in its entirety into another region on specified pages. This is especially useful for pages that need to have a different region layout, for example having the sidebar on the opposite side of the main content.

It is possible to achieve this with the Context module, but this was not applicable in my use case. My client needed a very simple module that allows to move the sidebars to the other side of the screen on certain pages and rejected Context because of its perceived complexity. Context is more of a site builder tool, while Move Region is an end user tool.

Sandbox: http://drupal.org/sandbox/pfrenssen/1411168
Repo: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/pfrenssen/1411168.git move_region

Module is for Drupal 7.

Comments

drupaledmonk’s picture

Please do a PAreview, it is showing one error.
http://ventral.org/pareview

pfrenssen’s picture

Hey, thanks for the speedy review!

I have already run the module through this awesome service and have fixed all errors except one before submitting the project application. It now only generates this error about the following doc block:

38 | ERROR | Doc comment for var $id does not match actual variable name $form | | at position 1

/**
 * Menu callback; Form builder for the configuration edit form.
 *
 * @param integer $id
 *   The unique ID of the configuration. Leave empty to create a new
 *   configuration.
 */
function move_region_configure_form($form, &$form_state, $id = NULL) {
}

In this case the script is confused because the default variables $form and $form_state are not documented. IMO this is a shortcoming of the automatic review script. I see this documentation pattern all over core. Here is an example out of block.admin.inc which has also omitted the documentation of $form and $form_state for a form builder:

/**
 * Form constructor for the main block administration form.
 *
 * @param $blocks
 *   An array of blocks, as returned by block_admin_display_prepare_blocks().
 * @param $theme
 *   A string representing the name of the theme to edit blocks for.
 * @param $block_regions
 *   (optional) An array of regions in which the blocks will be allowed to be
 *   placed. Defaults to all visible regions for the theme whose blocks are
 *   being configured. In all cases, a dummy region for disabled blocks will
 *   also be displayed.
 *
 * @return
 *   An array representing the form definition.
 *
 * @ingroup forms
 * @see block_admin_display_form_submit()
 */
function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_regions = NULL) {
}

I am willing to change this however if it is essential that the automated review passes with no errors. I could simply remove the offending line from the doc block. This would make the module marginally less documented but would satisfy the review script.

operinko’s picture

Status: Needs review » Needs work

Tested the functionality, works as intended.

As for issues:
I'm going to skip the doxygen issue, since it's been used that way in core as well.

But, there is one other minor issue that's easy enough to fix:
$output .= '<dd>' . t('With the Move Region module you can create multiple configurations in which you can decide which regions should be moved, where they should be moved to, and on which pages this should occur.' . '</dd>');

Just move the . '</dd>' outside the t() and you're good to go.

pfrenssen’s picture

Status: Needs work » Needs review

Thanks a lot for the review! Nice catch, I have fixed it and attributed the patch to you.

bulldozer2003’s picture

Status: Needs review » Needs work

Very simple but pretty cool module.

You need to complete your

tag on your last line of $output in move_region_help().
You could extend the array at the end of line 75 in move_region.admin.inc to multiple lines.

Don't worry I won't forget ya for a month.

pfrenssen’s picture

Status: Needs work » Needs review

Thanks a lot Brian!

I have fixed the missing closing tag. I do respectfully disagree about splitting the long instance of t() on line 75 of move_region.admin.inc. I have just spent some time looking at core to see how calls to t() are handled inside render arrays, and it is consistently put on one single line.

Here's an example that looks quite similar, from system_clean_url_settings():

  $form['clean_url_test_result'] = array(
    '#type' => 'markup', 
    '#markup' => '<p>' . t('Clean URLs cannot be enabled. If you are directed to this page or to a <em>Page not found (404)</em> error after testing for clean URLs, see the <a href="@handbook">online handbook</a>.', array('@handbook' => 'http://drupal.org/node/15365')) . '</p>',
  );
scot.hubbard’s picture

Automated review is clean with the exception of the line 75 error, which I agree is nothing to worry about.

Looking at the code I can find no issues, however, on testing the module with a clean drupal 7 install I did find one issue.

My first test was to try and swap the header into the footer region but nothing happened. I then tryied to swap the first sidebar into the second sidebar and this worked. Not sure if I have missed something or not.

I will leave as "needs review" in case anyone else finds the same issue. Good module though.

soncco’s picture

Status: Needs review » Reviewed & tested by the community

Very useful module!!!

@scot.hubbard works fine for me in all cases.

pfrenssen’s picture

@scot.hubbard: I can't replicate this problem, can you give some more information? Perhaps the content of your header is hard coded in a template file?

@soncco: thanks for the RTBC! :)

scot.hubbard’s picture

Hi pfrenssen,

It was a clean install of drupal 7 using the default theme. No theming work had been done at all.

Perhaps just a freak occurrence?!

bulldozer2003’s picture

@scot.hubbard I had no problems moving regions, but I did notice that regions were listed that bartik did not seem to be using. I ended up referencing my blocks/regions page to choose to that were being used and everything worked as it should.

pfrenssen’s picture

Status: Reviewed & tested by the community » Needs review

Indeed, when you have multiple themes installed it can be difficult to pick the right regions, especially since the region names of different themes are often very similarly named. After enabling 5 contrib base themes it became practically impossible to choose the regions. This probably also caused the problem from #7, since it is possible to select regions from two different themes.

I've updated the module and the regions are now separated out by theme. Much better :) If you would like to try it, please reinstall the module because the database schema has changed.

bulldozer2003’s picture

I'll try to take a look soon. Anyone else reading this, please feel free to comment a review.

patrickd’s picture

Regarding the workflow, are you sure you want to switch back to needs review?

pfrenssen’s picture

Status: Needs review » Reviewed & tested by the community

Good point, I was assuming that newly introduced code == a new review, but having read the workflow I think this is not really the way forward.

Setting back to RTBC as per #8.

patrickd’s picture

Assigned: Unassigned » patrickd
patrickd’s picture

Assigned: patrickd » Unassigned
Status: Reviewed & tested by the community » Fixed

Your project page is short and not very informative, please have a look at the tips for a great project page.

  • It results in the same but please use current_path() instead of $_GET['q'] when possible
  • don't put variables into t(), only using static strings within t('translate me') will be recognized by the translation system on d.o, therefore it makes no sense directly putting in variables into t()

Beside this your module looks good!

Thanks for your contribution and welcome to the community of project contributors on drupal.org.

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.

Thanks to the dedicated reviewer(s) as well.

pfrenssen’s picture

Great news, thanks a lot everybody!

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Replaced git repo with the public one.