Looks like the module intentionally deletes any commands from AJAX rendering that are settings to be merged.

From advagg_ajax_render_alter:
http://cgit.drupalcode.org/advagg/tree/advagg.module#n567

if (   $values['command'] === 'settings'
        && is_array($values['settings'])
        && !empty($values['merge'])
        ) {
      // Remove JS settings.
      unset($commands[$key]);
      continue;
    }

I'm not sure that this is a bug report or a support request, but what is the recommended approach for other code to add settings into a response to be merged with existing settings? Is there perhaps another way around the problem that this code was trying to solve? Happy to chip in with patches if I have a better understanding of the intention.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eshta’s picture

Issue summary: View changes
mikeytown2’s picture

It is by design. When does your commands for settings get added? Does is also happen inside of hook_ajax_render_alter when ajax_render is ran? If so then the best option is to have AdvAgg run first for that hook. AdvAgg is a heavy user of hook_module_implements_alter() because the ordering of hooks is vital in a lot of places.

eshta’s picture

Our settings are added via ajax_command_settings and returned from an AJAX callback using ajax_render.

mikeytown2’s picture

AdvAgg also uses ajax_command_settings http://cgit.drupalcode.org/advagg/tree/advagg.module#n594. ajax_command_settings is a way to merge in the commands from $settings['data']; those commands get added to the $commands array either from $settings['data'] via drupal_add_js or hook_ajax_render_alter from what I can tell.

AdvAgg replays the same code that core runs because core doesn't expect something like AdvAgg where it overrides aggregation. I'll go ahead and change advagg hook execution order so advagg_ajax_render_alter runs first.

  • mikeytown2 committed 34d9c38 on 7.x-2.x
    Issue #2349101 by mikeytown2: Make sure advagg_ajax_render_alter runs...
mikeytown2’s picture

This patch has been committed. You'll need to flush drupal's caches in order for it to take effect as hook_module_implements_alter is cached.

Let me know if how this goes.

mikeytown2’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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