whitecube / nova-flexible-content

Flexible Content & Repeater Fields for Laravel Nova
MIT License
790 stars 234 forks source link

Dynamically generate layout name? #136

Open spekulatius opened 4 years ago

spekulatius commented 4 years ago

Hello @Nyratas

Thanks for building this useful component!

Is it possible to change the title/name of the layout on the fly? Here "Entry":

image

If this isn't possible currently, I would wonder if there are plans to implement such a feature. It would be great if one collects data (myself for example) and wants to label them.

Cheers!

voidgraphics commented 4 years ago

Hi @spekulatius, this is currently not possible. However it would be a nice addition to the package, we just have to figure out how to make it work. Do you have any suggestions on how you would want it to work?

spekulatius commented 4 years ago

Hey @voidgraphics,

That's okay. I wasn't expecting to have a solution ready. Great you consider it as a potential enhancement :+1:

I thought about a method on the layout for this. The 'title' method exists & works to overwrite the title, but to make it useful it would require to have the current data within the layout. Not sure how this can be achieve easiest. Any idea? From there on it would be doable and pretty easy.

Peter

toonvandenbos commented 4 years ago

Hi @spekulatius,

Do you want to use a field's value as the title for the layout ? Or do you want to set it in when defining the layout with a title() method ?

spekulatius commented 4 years ago

I want to use part of a fields data/values (a date) as the title.

On Thu, 16 Jan 2020 20:19 Toon Van den Bos notifications@github.com wrote:

Hi @spekulatius https://github.com/spekulatius,

Do you want to use a field's value as the title for the layout ? Or do you want to set it in when defining the layout with a title() method ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/whitecube/nova-flexible-content/issues/136?email_source=notifications&email_token=ACAK7M6U6R675HTSGZQZWB3Q6BNF5A5CNFSM4KHSBH4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJEA2ZQ#issuecomment-575147366, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAK7M5YIZW5O5ZVFNJ32H3Q6BNF5ANCNFSM4KHSBH4A .

voidgraphics commented 4 years ago

Maybe a title function on the layout class could work, and would take precedent over the title attribute if it is defined.

The method would be able to access all the values stored in the layout, allowing the developer to format the title string however they want with all the values.

@Nyratas that should be doable, right?

Edit: Sort of like in regular nova resources

spekulatius commented 4 years ago

Yeah, the title function takes precedent over the variable. But the data isn't available. I've tried to access it directly as described in the link you shared @voidgraphics - no luck. I guess the data is populated differently or later in case of an layout vs. Nova resource, is it?

toonvandenbos commented 4 years ago

@spekulatius the behavior @voidgraphics describes has not yet been defined, it was a suggestion.

@voidgraphics I agree, good idea.

spekulatius commented 4 years ago

oh, okay. haha. I read it as it could (should) work like this. Sorry. Yeah - that would be awesome

bernhardh commented 3 years ago

I was looking for this feature as well. Any updates on this?

Blindmikey commented 3 years ago

This would be particularly useful when a client has several collapsed groups. Otherwise currently they just see a bunch of collapsed groups all with the same name. eg) "Entry".

As a dev coming from WP/ACF, this would be really helpful https://www.advancedcustomfields.com/resources/repeater/

- Collapsed
Enables each row to be collapsed by specifying a single sub field to display.

Also, storing collapsed fields in session management so revisiting the page doesn't have all of the collapsed fields expanded again.

bastihilger commented 3 years ago

If this isn't in the making already, I would like to write a PR for this.

scramatte commented 3 years ago

Any chance to get PR for this ?

bastihilger commented 3 years ago

Sorry - ATM I am working with a fork because I had to implement a lot of custom features rather quickly and could not wait for PRs to be accepted (don't get me wrong - I am not blaming the maintainers for anything here, I know how it is, but for me the fork was the best way back in April). Maybe some day I will try to "re-PR" some of the features back into this repo, but no time right now unfortunately.

scramatte commented 3 years ago

@manogi Can you give me access to the fork?

riptin commented 1 year ago

Any progress on this? It would be a great addition, since when there are many entries and the fields are collapsed, it gets really hard to find what you are looking for.