Support

Account

Home Forums Bug Reports Clone Field Bugs

Solving

Clone Field Bugs

  • There are 2 bugs I’m encountering with clone field type. Here is a run down of my setup:

    • I use Flexible Content repeater fields to add building blocks. One of them is called Content, for simple content needs, which supports content types such as (none, WYSIWYG, etc.)
    • I use field groups to manage fields of each building block, so there is a field group for Content, which has fields for content types, WYSIWYG, etc.
    • I use field groups to manage fields of components used in building blocks. One of those is Content. This is different from the building block above because this is content in its simplest form. The building block above may have additional fields.

    So a hierarchy of my blocks-to-components look something like this:

    1. Content (block field group)

      1. Header (component field group)

        1. Header Content Type (radio field)
        2. Header Content (wysiwyg field, shows if Header Content Type = “content”)
        3. Header Code (textarea field, shows if Header Content Type = “code”)
      2. Footer (component field group)

        1. Footer Content Type (radio field)
        2. Footer Content (wysiwyg field, shows if Footer Content Type = “content”)
        3. Footer Code (textarea field, shows if Footer Content Type = “code”)
      3. Background Settings (component field group)
        1. Background Type (radio field)
        2. Background Color (color field, shows if Background Type = “color”)
        3. Background Image (image field, shows if Background Type = “image”)
    2. Slider (block field group)

      1. Slides (repeater field)
        1. Content (component field group)
          1. Content Type (radio field)
          2. Content (wysiwyg field, shows if Content Type = “content”)
          3. Code (textarea field, shows if Content Type = “code”)
      2. Slider Settings (component field group)
        1. Autoplay (true/false field)
        2. Loop (true/false field)

    …totaling 5 field groups, 3 for reusability:

    1. Blocks
    2. Content: block part of building block list in #1
    3. Content: any block that needs content fields
    4. Background Settings: any block that needs background settings
    5. Slider Settings: any block that needs slider settings

    Bug 1

    When more than one field group shares the same name, the second field group’s name is not displayed in the clone field dropdown list of options. For example, when I add a clone field to other blocks to clone and use Content (#3), I see the field group name for #2 in the list, not #3. Though I do see the fields for #3 in the list.

    Bug 2

    When the same field group is present more than once as a clone field, despite using prefixed labels and field names, there does not seem to be any isolation with the conditional displays. They seem to be affected by the first instance instead. For example, using my setup example above, the conditional display for Footer Content and Footer Code is affected when Header Content Type is changed instead of Footer Content Type.

  • You should submit the bugs here https://www.advancedcustomfields.com/contact/

    The only suggestion I can make for bug 1 is to use unique names for your field groups.

    As far as bug 2 goes, if you are including the same field group multiple times in the same clone field then this is not a but. The fields will get the same prefixes and end up having the same field names and keys. You would need to use different clone fields to include clone the same group multiple times.

  • Hi John! Thanks for your response. For bug 2, there are actually 2 separate clone fields that clone the same field group. In my example, Header (component field group) and Footer (component field group) are 2 separate clone fields. I enabled prefix for both of them and that was where I saw the bug. Enabling prefix on the labels and field names gave me this setup:

    1. Content (block field group)
      1. Header (component field group)
        Prefix: Header

        1. Header Content Type (radio field)
          Field Name: header_content_type
        2. Header Content (wysiwyg field, shows if Header Content Type = “content”)
          Field Name: header_content
        3. Header Code (textarea field, shows if Header Content Type = “code”)
          Field Name: header_code
      2. Footer (component field group)
        Prefix: Footer

        1. Footer Content Type (radio field)
          Field Name: footer_content_type
        2. Footer Content (wysiwyg field, shows if Footer Content Type = “content”)
          Field Name: footer_content
        3. Footer Code (textarea field, shows if Footer Content Type = “code”)
          Field Name: footer_code

    The base field group for the component has these fields without the prefixes:

    1. Content (component field group)
      1. Content Type (radio field)
        Field Name: content_type
      2. Content (wysiwyg field, shows if Content Type = “content”)
        Field Name: content
      3. Code (textarea field, shows if Content Type = “code”)
        Field Name: code
  • Thank you for your response! I posted a reply to you for bug #2, but I’m not seeing it anymore. I will submit via the link you provided.

  • Your post got marked as spam for some reason, should be set.

    In that case it may have something to do with the group names as in bug #1.

    to be honest, I don’t know what could be the cause because the clone field should be looking that the group key and not the group name.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.