Skip to content

Conversation

@Artusamak
Copy link

This is a first version for the issue #194 to support Fieldgroups.
It displays the list of fieldgroups in the pattern config associated with a field group.

There is still an issue in the output as is. If you have a parent fieldgroup that is rendered with a pattern, within is rendered another fieldgroup which is itself a pattern. When the child fieldgroup is rendered, its fields are correctly display but the selected pattern template is not rendered.

@Artusamak
Copy link
Author

Please note that this implementation is inspired on the one in the PR #137 .

@Artusamak
Copy link
Author

What is happening in the output is that when we are in \Drupal\ui_patterns_field_group\Plugin\field_group\FieldGroupFormatter\PatternFormatter::preRender()

If the field is a fieldgroup using a pattern, #type, #id, #fields and #multiple_sources are not injected since there is no expectation to fetch those values.
We should have something recursive here to load the child fieldgroup configuration and inject the expected attributes because we could have a fieldgroup within a fieldgroup...

@Artusamak
Copy link
Author

This version of the PR starts to output content using the configured pattern.
Now the problem is that the pattern variables are not populated.
That's annoying ^^.

@Artusamak
Copy link
Author

Here we are! We are now able to have pattern fieldgroups within pattern fieldgroups (within pattern fieldgroups, within... you get it! ;)).

There is one improvement that could be made (at least) which is related to the fieldgroup config. I'm not sure that its doable but, within a fieldgroup, when we check the settings of the child fieldgroups, we have to load it from the EntityViewDisplay config file. If the user is modifying some settings (changing a target region for a field for instance), this setting may be inaccurate (but i'm not 100% sure).
If someone has a better implementation idea for that, feel free to update the PR.

@DuaelFr
Copy link

DuaelFr commented Aug 24, 2018

While testing this I had a really strange issue.

I have a field group "parent" that contains fields and another field group "child". It looks like the following.

  • FG parent
    • field A
    • field B
    • FG child
      • field C
      • field D

It's working well except that all the content of the field of the "child" field group is duplicated.

If I export the configuration, "parent" is defined before "child" in the YML. If I invert the two definitions then import config back to the database. The issue is fixed.

@ademarco
Copy link
Member

Wow, nice one! Could you please enable "Allowing changes to a pull request branch created from a fork" so I can push directly to your fork and work on the PR?

@Artusamak
Copy link
Author

Normally you have this permission. It doesn't work?

@ademarco
Copy link
Member

ademarco commented Aug 26, 2018

Nope, I get a permission denied when trying to push to your repo's 8.x-1.x branch, but ok, it's not necessary, I was just curious to see how that would work! 😄

@Artusamak
Copy link
Author

I gave you push access to the whole repo, it should do it this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants