Field groups are not copied when cloning display

Created on 30 November 2022, about 2 years ago
Updated 27 August 2024, 3 months ago

Problem/Motivation

For some reason $destination_bundle_field_names variable is not here at all, so, none of field groups will be copied when cloning display.

Steps to reproduce

1. Add field group to form display on one bundle
2. Try cloning that display to another bundle
3. Field group will not be copied

Proposed resolution

This is simply code mistake, so I will attach patch

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇷🇸Serbia holo96

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany Anybody Porta Westfalica

    I can confirm indeed the variable is never defined!

    So it will always be unset here without the fix:

    if (!isset($destination_bundle_field_names[$child_field])) {
      unset($group_settings['children'][$index]);
    }
    

    Where I'm not sure is, if the $destination_bundle_field_names = $destination_display->getComponents(); should be inside the field_groups condition?

  • Issue was unassigned.
  • 🇩🇪Germany Anybody Porta Westfalica

    Setting priority to major as this is a clear code bug which breaks expected (and existing) functionality.

  • 🇩🇪Germany Anybody Porta Westfalica
  • Status changed to Needs work 4 months ago
  • 🇬🇧United Kingdom joachim
    +++ b/src/DisplayCloner.php
    @@ -113,6 +113,8 @@ class DisplayCloner {
    +    $destination_bundle_field_names = $destination_display->getComponents();
    

    getComponents() does not return field names!

  • 🇷🇸Serbia holo96

    @joachim Is naming only issue you have with this?

    That's how it is named in module currently only variable init is missing, I guess it went missing in some point

    I will create new patch..

  • 🇩🇪Germany Anybody Porta Westfalica

    Just ran into this again, so I'll try to place this on our agenda.

  • First commit to issue fork.
  • 🇩🇪Germany Grevil

    I can confirm that the patch fixes the issue! Very weird, that the variable declaration of

    $destination_bundle_field_names
    

    was somehow removed.

  • Status changed to Needs review 3 months ago
  • 🇩🇪Germany Grevil

    I applied @holo96's patch as an MR and renamed the variable, please review!

  • Status changed to RTBC 3 months ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Thank you @Grevil, that's indeed a crazy reason for the bug ;D

    I think the fixes are okay, as it's not too many. RTBC! Would be great to have this fixed and Field groups support back again!

Production build 0.71.5 2024