Open Artusamak opened 6 years ago
Please note that this implementation is inspired on the one in the PR #137 .
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...
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 ^^.
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.
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.
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.
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?
Normally you have this permission. It doesn't work?
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! :smile:
I gave you push access to the whole repo, it should do it this time.
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.