I noticed that when you add a field via the hook_field_extra_fields() to a field group, it will not show up inside this field group but pops out of it.
For that reason I created a small test module on a clean Drupal install to be sure. This is also the case for preprocess fields created with Display Suite.

Screenshots:
Field group adminRendered node

The code for the test module (fg.module):

function fg_field_extra_fields() {
  $extra['node']['article'] = array(
    'display' => array(
      'test_field' => array(
        'label' => t('Test field'),
        'description' => t('Test field'),
        'weight' => 0,
      ),
    ),
  );
  return $extra;
}
function fg_preprocess_node(&$vars) {
  $vars['content']['test_field'] = array(
    '#markup' => t('Test field'),
  );
}

Comments

StatusFileSize
new5.38 KB

Included is a patch that should fix it.
This is a major change in the fieldgroup rendering functionality, so we will only add it to branch 2.

Status:Active» Needs review

Status:Needs review» Needs work

Ignore the patch, new coming soon :)

Status:Needs work» Needs review
StatusFileSize
new7.71 KB

The previous patch broke the forms. Included a new patch

Please review this, fieldgroup lovers!

StatusFileSize
new65.77 KB

I applied the patch and the fieldset now contains the extra field correctly, but everything appears twice as you can see on the screenshot...
Double output patch

hmm we had too at first but it worked after a fix. I'll look into this with zuuper

StatusFileSize
new7.68 KB

This should be better :). Vars was not given by reference after the refactoring for forms.

Status:Needs review» Reviewed & tested by the community
StatusFileSize
new32.7 KB

Great work! :-)
It works!

Version:7.x-1.1» 7.x-2.x-dev

Looking good.
Switching to branch 2.

Status:Reviewed & tested by the community» Fixed

The patch is now committed to 7.x-2.x

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Active

This doesn't work for me, using the latest 2.x-dev version.

The scenario is nothing special. A DS preprocess field that has been put in a div group with some other fields. The field gets it content from our_theme_preprocess_node() function.

I'm using custom display settings for Full content and Teaser.

If you need any more info or could point me in any direction to sort this bug out, please let me know.

I confirm that version 7.x-2.x-dev doesn't work. Module field group still doesn't group extra fields.

Any word on when this patch will be integrated into dev?

Assigned:Unassigned» zuuperman

I also confirm that newer versions are not working.
In production I'm still using a patched version (comment #8) of Field Group, the latest Field Group version at that time.
Since then, I tried to upgrade several times when new versions were coming out, but without success...

So I have a working (old) version in production which isn't updated since then...

Status:Active» Closed (cannot reproduce)
StatusFileSize
new53.64 KB

I just tested this with the latest version of DS. Both my custom preprocess field, and ds preprocess field appear in the correct group. (see screenshot)
Closing this for the moment. Re-open with extra information, if it still occurs with latest version of DS.

Status:Closed (cannot reproduce)» Active

I'm completely confused. I'm running into this same problem using horizontal tab items in the latest 7.x-1.x-dev (7.x-1.1+65-dev) of field_group and the latest dev version of DS (7.x-1.5+58-dev). Preprocess fields just dump outside the field groups.

I understand that the patch above is for 7.x-2.x but the project page for field_group says quite clearly "The 7.x-2.x branch will not be supported any longer...Note: Current changes are made in the 1 branch."

Which branch am I supposed to be using that incorporates fixes for these problems? If I need to switch to the 2.x branch, are there any upgrade path implications for my existing configuration?

Currently, the 7.x-2.x branch is not yet merged with the 7.x-1.x branch. If you want the preprocess functions, you can apply following patch. http://drupal.org/files/fieldgroup-preprocess-1342878_0.patch

This patch is currently in 7.x-2.x, but will be merged to 7.x-1.x

Hmmm... okay, well, I tried applying the patch against field_group-7.x-1.1+65-dev:

we11!w_pgt:~/public_html/pgt/sites/all/modules/field_group$ patch -p1 < fieldgroup-preprocess-1342878_0.patch
patching file field_group.module
Hunk #1 succeeded at 165 (offset -2 lines).
Hunk #2 succeeded at 230 (offset -2 lines).
Hunk #3 succeeded at 1203 (offset -10 lines).
Hunk #4 succeeded at 1696 (offset -2 lines).
Hunk #5 succeeded at 1760 (offset -2 lines).
Hunk #6 succeeded at 1776 (offset -2 lines).

But now none of my preprocess fields are rendered at all inside or outside of groups. They're just gone.

Any ideas why this might be?

belay any response. Just saw a bug. Let me look at that before expending any energy on your part. thanks.

Well, fixed my bug. Now DS preprocess fields are being rendered, but outside the groups. Worse still, it appears that something in the patch jacked up the js so Horizontal Tab Items aren't working:

Uncaught TypeError: Object # has no method 'drupalGetSummary' horizontal-tabs.js:128

Maybe I'm misunderstanding this issue. I'm not using the extra fields option by name. I'm adding a DS Custom Preprocess field which latches onto a variable in preprocess_node function. Is there a difference here in how it should group or not group this?

Okay, I rewrote my code to match the fg.module. The test_field *IS* rendered in the right group, but I still get the javascript error:

Uncaught TypeError: Object # has no method 'drupalGetSummary' horizontal-tabs.js:128

when using Horizontal Tabs which essentially makes this useless. The code in the patch and its context is too complex for me to immediately grok how its interaction is killing the js. I'd really appreciate someone more intimate with the code taking a look.

One thing I can comment on is that when the patch is applied and you dpm a field, it's no longer field_X['und'][0]... It's field_X[0]... So this patch appears to be changing the field structures on fields it's not supposed to be messing with and in ways I don't think it should be. I mean, it shouldn't be deleting language parameters on the object should it? And if that's the case and it's not standard, then maybe the javascript is failing because the drupal method (drupalGetSummary) is not finding the object in the format that it's expecting?

Someone please help. My head hurts. :-)

StatusFileSize
new94.39 KB

Just attaching a screenshot showing that "Test field" IS rendered, but horizontal tabs, they ain't:

Only local images are allowed.

Here are two screenshots showing dpm's of field_product_line from hook_preprocess_node. As you can see one is structured as:

field_product_line['und'][0]... (field_group-7.x-1.1+65-dev without fieldgroup-preprocess-1342878_0.patch; horizontal tabs still work at this stage)

The other shows the structure as:

field_product_line[0]... (field_group-7.x-1.1+65-dev WITH fieldgroup-preprocess-1342878_0.patch; horizontal tabs are completely broken after applying patch)

Status:Active» Closed (fixed)

Since it appears the field *IS* actually rendering inside the correct group (the original problem) and the patch has been committed to the 2.x branch to be merged with the 1.x branch but the patch is killing horizontal tab display, I'm closing this thread and opening a new, related one regarding the now non-functional horizontal tabs.

Is there any way to get this into 1.x?

The patch from #20 applied without error, although my fields are still outside of the horizontal tabs after clearing my cache and commenting out line 138 of horizontal-tabs.js where this.fieldset is not an object.

Patch #8 doesn't work for me.
Display Suite: 7.x-2.2
Fieldgroup: 7.x-1.1 (also tried 7.x-1.dev and 2 v too)
Did anyone resolve this issue?

Status:Closed (fixed)» Active
StatusFileSize
new8.07 KB

Doesn't work for me either. As said in #30, the patch applies just fine, but it doesn't fix the issue.

I've created a content type with a field group and a preprocess field that I've put in a Feature.

Modules involved

  • Drupal core 7.22
  • Chaos tools 7.x-1.3
  • Display Suite 7.x-2.3
  • Features 7.x-2.0-rc1
  • Field Group 7.x-1.x-dev from 2013-May-16 (with patch from #20 applied)
  • Strongarm 7.x-2.0

Steps to reproduce

  1. Install Drupal using the Standard profile.
  2. Download the attached feature and enable it.
  3. Add $variables['preprocess_field'] = 'This is the preprocess field.'; to the preprocess_node function for the default theme. In my case, this was Bartik.
  4. Create a Preprocess test node with random values for Title and Body.
  5. View the node. The Title and Body will be located inside of the group. The preprocess field will be located outside of the group.

Version:7.x-2.x-dev» 7.x-1.x-dev

I'll move this to 7.x-1.x as we merged 2 into 1. Could anyone retest if the problem still occurs?

Status:Active» Closed (fixed)

This should be fixed in latest release. There is only 1 bug left, #2049291: Wrong order of the fields

Issue summary:View changes

Added screenshots

Issue summary:View changes
Status:Closed (fixed)» Active

I'm still having this issue with a preprocess DS field not wanting to render inside a field_group. DS Code fields and DS Block fields both render fine inside a field_group.
Versions:
field_group 1.3
ds 2.6

To replicate, create a DS preprocess field, run hook_preprocess_node to add content to the field, place it inside a field_group and see it rendering outside.
Also note preprocess fields don't have all the markup around them, making me think they are not run trough the theme_field function, could this be related?

Thanks for your hard work!

#33 Worked for me.

Same problem as mentioned in #35

same as #35, I'll vote to re-open this