New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial field in replicator and grid #723

Closed
okse opened this Issue May 31, 2016 · 23 comments

Comments

Projects
None yet
9 participants
@ghost

ghost commented May 31, 2016

It would be awesome, and I would very much appreciate the possibility of using a partial field in a replicator. Thank you :)

@thestepafter

This comment has been minimized.

thestepafter commented Jul 30, 2016

Are there any plans to add this in the next version?

@rrelmy

This comment has been minimized.

rrelmy commented Apr 21, 2017

This would be very useful!

@wesort

This comment has been minimized.

wesort commented May 9, 2017

+1 for this from me too.

@jasonvarga jasonvarga changed the title from Partial field in replicator to Partial field in replicator and grid Jun 8, 2017

@kevnk

This comment has been minimized.

kevnk commented Jun 26, 2017

+1

@rickysalsberry

This comment has been minimized.

rickysalsberry commented Jul 18, 2017

+1, was surprised this didn't work

@mmintel

This comment has been minimized.

mmintel commented Aug 15, 2017

mh are there any plans on this? i think this feature decides whether i am going to buy a license or not..

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Aug 15, 2017

@mmintel it boils down to a little copy and pasting whether you're going to use the whole CMS or not?

@mmintel

This comment has been minimized.

mmintel commented Aug 15, 2017

that means no there are no plans? :D
I think you should be careful about buying a software if there is a bug like that which exists for more than a year and is still not updated in the docs, so i don't know what else doesn't work but is not mentioned anywhere. And if I would like to copy and paste my code I would not really need a CMS at all. But that was not my question..

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Aug 15, 2017

It's not a bug though, it's just not a feature we've added yet because it's actually very complex to implement. I WANT to do it, i just don't know if we CAN do it without having to rewrite a large chunk of the fieldtype logic.

@mmintel

This comment has been minimized.

mmintel commented Aug 15, 2017

But yes I want to make heavy use of that feature and for me its very important to move this into small files instead of having one file which will be really big for my case. Maybe you should remove this from the docs if it doesn't exist and is not planned to be added at the moment.

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Aug 15, 2017

Partials do exist, they're just for root level fieldset stuff. We'll look into it again.

@mmintel

This comment has been minimized.

mmintel commented Aug 15, 2017

I mean there is a code example in the replicator field documentation, you should remove the code example that uses a partial, just to avoid more confusion.

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Aug 15, 2017

That documentation is for template partials, not fieldset partials. Totally different, though I do see how someone might mix those up. We really should have called CP partials "includes" or "imports".

@mmintel

This comment has been minimized.

mmintel commented Aug 15, 2017

Okay I am confused. I try this code:

{{ relate:components }}
  {{ modules }}
    {{ type }}
    {{ partial src="sets/{type}" }}
  {{ /modules }}
{{ /relate:components }}

and it doesn't display my partials which are in /partials/sets with same name of type. but {{ type }}displays the expected value.

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Aug 15, 2017

Wait, is this issue about Fieldset partials or Template partials? Now I'm confused!

@thestepafter

This comment has been minimized.

thestepafter commented Aug 15, 2017

Partials in replicators would definitely be a big benefit since cutting and pasting code is prone to error and field set files can get rather large. This would also help with creating more modular field sets where you want a field set based on a specific set of data but you also want some common fields included. For example, events, news, blog posts, all have common date elements of when you want to schedule them to be posted, start and end date, etc. It would be nice to be able to add this on the fly in a replicator instead of having separate field definitions for the same thing.

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Aug 15, 2017

Right @thestepafter, i totally get why folks want use a Partial Fieldtype to make configuring Replicator fieldsets easier and more DRY. I think @mmintel is talking about using variables inside partial src attributes in Antler templates, which is totally different.

@mmintel

This comment has been minimized.

mmintel commented Aug 15, 2017

Mh everything I want to do is using the replicator field type like the docs recommend it. I want to move my "if-else" statements into small template partials. Of course I want to use the variables of the replicator field in my partial, otherwise it would not make sense to use it like that?

@thestepafter

This comment has been minimized.

thestepafter commented Aug 15, 2017

@mmintel You can do this then, just pass the values from the replicator to the partials like this:

{{ partial:list header="Favorite Animals" :items="animals" }}

Then you can reference the value of header and items in the partial template file.

I do this extensively with my templates.

@mmintel

This comment has been minimized.

mmintel commented Aug 15, 2017

For me that doesn't work..

I have this code in my template:

{{ relate:components }}
  {{ modules }}
    {{ if type == 'title'}}
      This is the title
      {{ partial:title }}
    {{ elseif type == 'subtitle'}}
      {{ partial:subtitle }}
    {{ /if }}
  {{ /modules }}
{{ /relate:components }}

And this here is my project structure:
2017-08-15_screenshot

The message "This is the title" is displayed, the partial is not visible.

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Aug 15, 2017

Can you take this to Slack or the Lodge for some support? Happy to help, but this isn't related to this particular Issue :)

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Aug 15, 2017

@mmintel You have your partials directory inside the templates directory. It should be one level up.

/site/themes/yourtheme/
|-- partials
|    |-- subtitle.html
|-- templates

However, this Github issue is concerning partial fieldtypes inside of grid and replicator fieldtypes when used in the context of a fieldset.

@mmintel

This comment has been minimized.

mmintel commented Aug 16, 2017

alright, sorry that I used wrong issue, i thought thats exactly the same problem. really confusing with partials, but now I am at least happy that my problem was solved and I can continue using this CMS :D

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