Small bug that I've noticed when making changes to a view display. When you are adding or modifying any setting for a display, and you click the override button, it closes the settings box. It saves the overridden status, but is rather annoying. In D6, clicking on the override button overrode the default display, but kept the settings box open so you could make or continue to make changes. With this you have to add or modify a setting, click override, then click on that setting to then make changes.

I am using the 7x-dev April 30th versions of both Drupal7 and Views.

CommentFileSizeAuthor
#4 788950-override.patch1.67 KBdawehner

Comments

dawehner’s picture

This could be caused by the same bug as http://drupal.org/node/734062

The function views_ui_ajax_form looks a bit different in d7, perhaps there as something missported.

bojanz’s picture

Here's a comparison of the mentioned function between the 6.x-3.x and 7.x-3.x version.

The called functons would probably need to be compared too, since I didn't feel very enlightened after reading the diff ;)

dawehner’s picture

I hoped fixing re_render would do it, but at no level.

So what's the problem:

The code should look like this:

function views_ui_ajax_form($js, $key, $view, $display_id) {
  ...
  $output = views_ajax_form_wrapper($form_state['form_id'], $form_state);

  if (!$output) {

Currently it's $form_state['submitted'].

The problem is that $output is not empty when you click "update" on the filter. So the item form never do a redirect, so you don't come back to the main form.

Views in d6 hat this fapi part:

    // If we were told not to redirect, but not told to re-render, return
    // here.
    if (!empty($form_state['executed']) && empty($form_state['rerender'])) {
      return;
    }

This is used by d6 views to have a empty output.

So from my perspective we have to simulate rerender in views_ajax_form_wrapper or find a way to do this with d7 fapi and write everything that it does work as expected.

But this is really not trivial

You better shouldn't have two not equal fapi's and mixed ajax frameworks.

dawehner’s picture

Status: Active » Needs work
StatusFileSize
new1.67 KB

Puh.

Now this patch allows to use views without js :) But there are some type problems with js enabled.

dawehner’s picture

I think http://drupal.org/node/626732 has the same problem.

bojanz’s picture

Applied the patch.
Clicking "Expose" or "Hide" gives me the above mentioned type errors, looking like this:

Fatal error: [] operator not supported for strings in views/includes/admin.inc on line 1694

The offending part is this:

elseif ($js) {
  $output[] = views_ajax_command_disable_buttons();
}

In this case $output is a html string, hence the error.
I tried placing "$output = array();" above the offending line, but that just caused the links/buttons to go dead.

So, views_ajax_form_wrapper() needs some more loving...

Tried it with JS disabled, clicked around what's interesting is that even with JS off, the exposed form settings validation doesn't work.

dawehner’s picture

I should have written this in my comment. That's exact the problem where i stopped.


+  if (!empty($form_state['executed']) && empty($form_state['rerender'])) {
+    return array();
   }

I think this stops the validation.

dawehner’s picture

I commited this part

+  // These forms have the title built in, so set the title here:
+  if (empty($form_state['ajax']) && !empty($form_state['title'])) {
+    drupal_set_title($form_state['title']);
+  }

This has nothing todo with the central problem.

dawehner’s picture

There is hope in the darkest times :)

[01:34] <merlinofchaos> dereine: There is no equivalent to rerender now because drupal_build_form() doesn't render at all.
[01:34] <merlinofchaos> dereine: So you can eliminate that entirely and make your decision about rendering after you get the $form array back.
[01:35] <merlinofchaos> dereine: You may want $form_state['no_redirect'] = TRUE to guarantee you don't get redirected.
dawehner’s picture

One's this issue is fixed the test for views_exposed_form should not fail anymore.

dawehner’s picture

Status: Needs work » Fixed

YE...EAH!

Based on some magic this issue is now solved.

Status: Fixed » Closed (fixed)

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