Skip to content
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

New dcaPicker: Limit tab items #924

Closed
daniel-berger-nemeth opened this issue Jul 4, 2017 · 12 comments
Closed

New dcaPicker: Limit tab items #924

daniel-berger-nemeth opened this issue Jul 4, 2017 · 12 comments
Assignees
Labels
Milestone

Comments

@daniel-berger-nemeth
Copy link
Contributor

Hi,
is it currently possible to limit the tabs of the new dca picker?
If not it would be nice to have a feature like this.

As example to create a field with dcaPicker=>true and limit the possible tabs to "news" and "events" instead of showing all tabs.

Thanks and great job!

@Toflar
Copy link
Member

Toflar commented Jul 5, 2017

You cannot limit the tabs. We discussed that and we do not think this makes sense because the picker is extensible and every developer can add their own tabs which you would then need to explicitly allow in every single DCA configuration where that picker is being used. That would be a nightmare to maintain 😄 That's why there is the concept of the context. There are basically three contexts: link, file and page. Depending on the context, not all of the tabs are shown. E.g. if you choose file, you won't have news and events because they make no sense for file selection.

Just pass 'dcaPicker' => ['context' => 'file'] to test that.

@daniel-berger-nemeth
Copy link
Contributor Author

Thanks toflar for your answer!
Is it possible to extend the context with a new type or do we have then the same problem mentioned above?

@fritzmg
Copy link
Contributor

fritzmg commented Jul 5, 2017

You cannot limit the tabs. We discussed that and we do not think this makes sense because the picker is extensible and every developer can add their own tabs which you would then need to explicitly allow in every single DCA configuration where that picker is being used. That would be a nightmare to maintain

Contexts are fine - but I do not understand that reasoning. If you want to limit your picker to only News articles for example, why would you care about the extensibility of the picker from other arbitrary extensions? I was also hoping that this would be possible.

@leofeyer
Copy link
Member

leofeyer commented Jul 6, 2017

If you don't grant access to anything but news and events, there will be only those two tabs.

@fritzmg
Copy link
Contributor

fritzmg commented Jul 6, 2017

Of course - but I meant what if I want to create a widget, where I specifically only want news to be picked. The editor has access to events as well general, but I do not want him to be able to pick events or anything else but news for that widget.

@aschempp
Copy link
Member

aschempp commented Jul 6, 2017

You would probably need to define your own context and implement a picker for it.

@daniel-berger-nemeth
Copy link
Contributor Author

Is assigning a new context as easy as it looks? Just add a context==='newtype' in the Menu class and then add it to DCA: dcaPicker=>array('context'=>'newtype') ??

@aschempp
Copy link
Member

aschempp commented Jul 12, 2017

you also need one or multiple providers that support the context.

@contao/developers we might want to support context link_news to pick just a news items etc.
Alternatively, it would be fairly simple to define allowed providers with my PR #950 as they now have names/aliases.

@Toflar
Copy link
Member

Toflar commented Jul 12, 2017

it would be fairly simple to define allowed providers with my PR #950 as they now have names/aliases.

That would be best, imho.

@leofeyer leofeyer added this to the 4.4.2 milestone Jul 13, 2017
aschempp added a commit to aschempp/contao-core-bundle that referenced this issue Jul 13, 2017
@aschempp
Copy link
Member

aschempp commented Jul 13, 2017

This is now supported in #950

'eval' => ['dcaPicker' => ['providers' => ['filePicker']]]

@leofeyer
Copy link
Member

Great, thank you @aschempp.

@daniel-berger-nemeth
Copy link
Contributor Author

Big thanks and good job guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants