CCK fields may not display correctly in DS if the normal CCK display settings have been saved in a certain way, or in a certain order, or after the DS buildmode was saved. This affects multigroups especially badly.

The proposed solution is to intercept the default CCK display settings on a per buildmode basis, and where the display is controlled by DS, lock the settings and provide a link to the DS page.

Comments

xtfer’s picture

wizonesolutions’s picture

I've been reviewing #799332: Conflicts with CCK Fieldgroup tabs and #1097260: In cell sorting as well as the suggested workaround (#799332-15: Conflicts with CCK Fieldgroup tabs) but with no luck. I was initially overriding the Mobile build mode from Mobile Tools but have since created a custom build mode and configured the fields there.

What's extremely weird is that if I configure a view to use the Unformatted style plugin and the Node row plugin, then configure the Node row plugin to use my custom build mode, the AJAX preview renders correctly!. This leads me to think it's the theme, but this happens on two different themes! It boggles my mind!

I do notice that Views's preview doesn't seem to call preprocess functions, at least not theme-level ones...although since I'm using ND in override mode (nd_preprocess_overrideworking.

But all that aside, things look good in the Views preview but not in reality in either theme. I'm trying to figure out the magic angle here that is behind this.

Just tried disabling Mobile Tools, and that didn't fix it either. This is truly Worse Than Failure!

Going to go through the two ways of rendering it (Views preview and Views reality) in Xdebug and see if anything jumps out at me...

wizonesolutions’s picture

OK, I ran through in Xdebug, and basically what's happening is within this block of code around line 415.

        // Theming function. This implies a 'content' key exists.
        if (isset($object->ds_fields[$key]['theme']) && isset($object->ds_fields[$key]['content'])) {
          $count++;
          $region_content .= theme($object->ds_fields[$key]['theme'], $object->ds_fields[$key]['content'], $object->ds_fields[$key]);
        }
        elseif (isset($object->ds_fields[$key]['tab'])) {
          $count++;
          $region_content .= theme('ds_tabs', $object->ds_fields[$key]);
        }
        // Default ds_field theming function.
        else {
          $field_content = isset($vars[$key .'_rendered']) ? $vars[$key .'_rendered'] : '';
          if (!empty($field_content)) {
            $count++;
            $region_content .= theme($theme_function, $field_content, $object->ds_fields[$key]);
          }
        }

In my case, $field_content came back empty due to field_myfieldname_rendered not existing in the variables array. So it seems like if I fake rendering in my fusion_mobile_node_preprocess function just before passing control to

_nd_preprocess_node($vars, $hook);

that I would be able to psyche out DS and the theme layer, but OMG that'd probably be the worst hack evar...and I don't really know what to fake either. Well...maybe I will after running through the Views AJAX preview in Xdebug :)

More to come, probably.

wizonesolutions’s picture

Wow, I tried stepping through Views and can't even figure out how Node Displays is getting its build mode in there! I know it is because it responds when I change things, but how appears to be pure magic. I've put breakpoints on everything mentioning Views and on the normal preprocess functions but nothing is catching.

Going to put this down for today and see if anyone has responded tomorrow.

wizonesolutions’s picture

OK, I just thought I would take this to Google to see if I was going in the wrong direction and stumbled across #1060062: custom CCK fields do NOT appear while core fields do appear. I tried the suggestion of disabling/renabling all DS-related modules, but unfortunately that didn't do it either. I was really hopeful :(

I'll just give this issue some time to see if anyone replies tomorrow.

wizonesolutions’s picture

Weird. Disabling and re-enabling nd_cck appears to have corrected the issue for me, for now. Not gonna question it. Just happy it's working.

xtfer’s picture

@wizonesolutions - If disabling and reenabling nd_cck fixes your issue, than you probably are dealing with the issue listed here, however as you haven't actually described you problem, I can't really be sure... :)

Display Suite doesn't save any information about CCK fields, it changes the CCK settings themselves then just lets the field rendering pass through. Any module which changes the CCK field settings on the fly will interfere with this process, as will saving CCK settings without re-saving Display Suite settings. This is the fundamental reason CCK Fieldgroup Tabs doesn't work.

The solution you proposed at #3 (adding a field_key_rendered element) is an acceptable work around in some cases, however you should really be checking why that key doesn't exist in the first place, and if its a CCK field then the problem lies with CCK or a related module somewhere.

As for how Display Suite inserts its build mode information, it runs in hook_nodeapi() in the 'alter' operation, so it will load anytime that hook is invoked. Display Suite Views, on the other hand, has some specific Views related code that fires the buildmode if the DS Object or DS Fields items are selected.

wizonesolutions’s picture

Oh, so I didn't! Problem was that CCK fields weren't appearing. And the cause actually was Content Permissions + me forgetting that I had Content Permissions on the site. For shame!

xtfer’s picture

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

Bumping the version. This is unlikely to be fixed in 2.x