To make it easier for the user to place blocks on empty regions, I needed a "Show empty regions" toggle button on the context_editor form that integrates with the admin sidebar. Since placing content in these regions can cause issues with theme rendering, I only wanted the user that pressed the button to have the empty regions shown.

This patch adds a button to toggle the show empty region for the module and only enabled the variable for only the user that pressed the button.

Cheers!

Comments

timcosgrove’s picture

StatusFileSize
new3.94 KB

I made a minor usability improvement to this patch; it now says 'Show/Hide empty regions' depending on whether they are hidden or shown. The patch is re-rolled.

yhahn’s picture

Version: 6.x-3.0-beta5 » 6.x-3.x-dev
Assigned: Unassigned » yhahn
Priority: Normal » Critical
indytechcook’s picture

I just noticed something on tim's patch. Where he setting the value for the button:

+  // Toggle button
+  $toggle_status = array_values(variable_get('context_ui_editor_toggle_status', array()));
+  $form['toggle'] = array(
+    '#type' => 'submit',
+    '#value' => $toggle_status[0] ? t('Hide Empty Regions') : t('Show Empty Regions'),
+    '#submit' => array('context_ui_editor_toggle'),
+  );

The context_ui_editor_toggle_status variable holds an uid=> status array so it shouldn't be pulling the array_values and needs to check the $user->uid;

Neil

indytechcook’s picture

Probably should add a few more items to make this a little better.

1. Tell the user, very obviously, what mode they are in.
2. When the user presses "save changes" it turns the setting off for the user.

Now to get a patch.

yhahn’s picture

I took a look at this and I think it's a good idea/right direction but needs some work. My thoughts:

  1. If this is a per-user setting I would like to move it out of the variable system entirely and use $user->data or even the user's session. This would also mean that this setting is in some sense a temporary/administrative setting (which makes sense).

  2. I'd like this to be implemented at the block reaction plugin level, not the context_ui level.

xjm’s picture

Tracking.

indytechcook’s picture

Status: Active » Needs review
StatusFileSize
new3.74 KB

Updated patch using the block reaction. I wanted to use ->editor_form_submit() but the press_button element isn't passed, only the values from that plugin. No worries as I didn't want to react to the save button anyway.

Cheers!

yareckon’s picture

Also looking forward to this being standard.

michaellander’s picture

Any word on this making it into HEAD? The admin module used to have this as a setting, but it has since been removed and I think it is tremendously useful. Same with the drupal 7 version. I'd be happy to help anyway I can.

henrijs.seso’s picture

Some dynamic updating would be good. AJAX is less cool with workflow that reloads page two three times.

ultimateboy’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Priority: Critical » Normal
StatusFileSize
new2.83 KB

Re-rolled this against 7.x-3.x-dev. No dynamic updating with ajax, just a straight re-roll of #7.

yareckon’s picture

Priority: Normal » Major

If firmly believe that this not being in context by default is a big reason why a huge number of people aren't managing their layouts with context editor. I'm gonna go and set this to major. Under feature requests, that shouldn't create too much queue noise.

goron’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev

I'm looking for a similar functionality at the moment. My observations so far on this:

The problems

  1. If the global 'Show all regions' setting is off, it's impossible to add content using the inline editor to empty regions
  2. If the setting if on, it can be difficult to see while using the inline editor how the page would look if the page was not in inline-editing mode (in many themes the empty regions, without the context drop areas, wouldn't show at all). That is, it's easy to rearrange the page, but difficult to preview how it'll look with the new arrangement outside of inline editing mode.
  3. In some themes, if the global setting is on the theme might display the empty regions even though the context blocks in them are hidden by CSS. This can be a reason that administrators have to turn the setting off, triggering problem #1.

The patch so far

  1. The patch above adds a per-user session variable which overrides the global 'display all regions' setting, and a button in the inline editor to toggle that variable
  2. When the button is pressed, the variable is toggled and the page is reloaded. This leads to the regions being rendered (or not) correctly, and provides the ability to edit with or without showing all regions.
  3. It also means very poor usability, since a user needs to open the editor, toggle the setting, wait for the page to load, open the editor again, make changes, save, and then toggle the variable again

Solving the problems

  1. It seems that the ideal would be the following:
    1. The global 'Show all regions' setting is off, unless you really want to show all regions all the time
    2. When entering inline editing mode, all regions are displayed, so that blocks can be moved in and out of them
    3. A toggle (or "preview") button is provided in the editor, so the page can be viewed as if the setting was disabled
  2. Ideally this would be done with AJAX, but I'm not sure that's actually possible, since in some themes (particularly, Garland), the way the page is rendered depends on whether certain regions are empty or not.
  3. If a page load is indeed necessary for the toggle to work, the solutions would need to be like one of the following to be usable (IMO):
    1. When the toggle happens the page reloads, but the inline editor "remembers" its position and is reloaded open.
    2. The page is somehow reloaded "behind" the editor, so that the editor stays open and the whole page is reloaded behind it, maybe by AJAX.

I've been trying to work on this patch, but this is where I get kind of stuck and am not sure how to proceed. I'm interested in getting feedback about this, and hoping this summary will refresh the issue. Please let me know if you disagree with anything or if I left things out.

mrfelton’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
StatusFileSize
new3.01 KB

Essentially, I with everything said in #13. And, the patch so far is a good start, although it does't actually work for me. Attached is a version that does work. It changes the logic in editable_region() so that the empty regions are only shown if the context_ui_editor_present is actually true. Unless I'm missing something, It doesn't make any sense to show them otherwise.

@goron - I'm pretty new developments will be going in against the 7.x branch first, with a possible backport to D6. So this should be set to 7.x-3.x.

mrfelton’s picture

Patch updated against latest dev

jpstrikesback’s picture

Assigned: yhahn » Unassigned

Correct me if I'm wrong but this needs unassigned.