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

Get filetree picker url parameters via own method #579

Merged
merged 3 commits into from Jan 9, 2020

Conversation

@rabauss
Copy link
Contributor

rabauss commented Jul 14, 2019

Get the picker url parameters via own method, to get the possibility to overwrite/extend it in own extensions.

@rabauss rabauss changed the title get picker url parameters via own method Get filetree picker url parameters via own method Jul 14, 2019
@leofeyer leofeyer added the feature label Jul 23, 2019
@leofeyer leofeyer added this to the 4.9 milestone Jul 23, 2019
@aschempp

This comment has been minimized.

Copy link
Contributor

aschempp commented Jul 24, 2019

Can you explain why you want to override the FileTree? And can you not just set these properties on the object?

@rabauss

This comment has been minimized.

Copy link
Contributor Author

rabauss commented Jul 24, 2019

We want to transfer more context data (table, field, id, providers) to the picker url, so that we can use it for calls to our external asset managment system. The extension is still in progress - but kind of similar to https://github.com/terminal42/contao-bynder/

@Toflar

This comment has been minimized.

Copy link
Member

Toflar commented Jul 24, 2019

Maybe you should have your completely own picker instead of extending the core one then?😊

@aschempp

This comment has been minimized.

Copy link
Contributor

aschempp commented Jul 28, 2019

I guess contao/core-bundle#1171 is what you need. Until then you should create your own widget and not extend the core widget.

@rabauss

This comment has been minimized.

Copy link
Contributor Author

rabauss commented Aug 21, 2019

Well, yes we could use our own picker but we wanted to replace the filepicker with custom asset picker from external system - and so we thought this could be achived best by replacing/extending the core filetree without too much duplicate code for similar widget.

@aschempp

This comment has been minimized.

Copy link
Contributor

aschempp commented Aug 22, 2019

You should probably not replace the file widget, but add a new picker to the popup? We did something similar in https://github.com/terminal42/contao-bynder

@rabauss

This comment has been minimized.

Copy link
Contributor Author

rabauss commented Aug 22, 2019

I know your extension. But we want to support the core filemanager and external DAm just for the first insert. After picking a file from the external DAM we want to disable the core filepicker. I think this is only possible via overwriting the core filetree, isn't it?

@aschempp

This comment has been minimized.

Copy link
Contributor

aschempp commented Aug 22, 2019

There are picker configuration options to limit the available tabs in the back end. Not sure if you can specify them for the filePicker though.

@rabauss

This comment has been minimized.

Copy link
Contributor Author

rabauss commented Aug 22, 2019

At the moment we set $extras['providers'] = 'ourPicker' in the fileTreeWidget if the FileModel has an ID of the external DAM - therefor among other variables for the pickerUrl (like fieldname, table), we added this PR!
Of course we could write an own widget (like we did at the moment), but the only difference to the fileTree would be the extra picker url variables.

@aschempp

This comment has been minimized.

Copy link
Contributor

aschempp commented Aug 22, 2019

I understand now. In the regular extra => dcawizard => [] field you can add unlimited props for the pickers. Maybe we should introduce something similar for this case?

Or rather have a universal picker and use it everywhere 😇

@rabauss

This comment has been minimized.

Copy link
Contributor Author

rabauss commented Aug 22, 2019

Yes, an universal picker in the core would be the best :-)
We have an internal package adapted to the contao/core-bundle#1171 but there is too much legacy code inside to reuse.

@leofeyer leofeyer force-pushed the contao:master branch from 2ea6ebd to 91d73a0 Sep 26, 2019
@leofeyer

This comment has been minimized.

Copy link
Member

leofeyer commented Jan 2, 2020

@rabauss @aschempp What is the status of this PR now that we have added a universal picker in #714?

@rabauss

This comment has been minimized.

Copy link
Contributor Author

rabauss commented Jan 3, 2020

The main problem remains in the widget and also in the new picker widget.

<p><a href="' . ampersand(System::getContainer()->get('contao.picker.builder')->getUrl($strContext, $extras)) . '" class="tl_submit" id="picker_' . $this->strName . '">' . $GLOBALS['TL_LANG']['MSC']['changeSelection'] . '</a></p>

The url parameters ($extras) for the picker cannot be overwritten/extended, if someone extends the class! I think I should rebase this PR and I will open another one for widgets/Picker.php

@rabauss rabauss force-pushed the eikona-media:feature/filetree branch from a879c82 to b719fcd Jan 3, 2020
leofeyer added a commit that referenced this pull request Jan 7, 2020
Description
-----------

see: #579 (comment)

Commits
-------

f02c53d Get universal picker url parameters via own method
65cdb43 Update doc
leofeyer added a commit to contao/core-bundle that referenced this pull request Jan 7, 2020
Description
-----------

see: contao/contao#579 (comment)

Commits
-------

f02c53da Get universal picker url parameters via own method
65cdb430 Update doc
Co-Authored-By: Leo Feyer <github@contao.org>
@aschempp aschempp requested a review from leofeyer Jan 9, 2020
@leofeyer leofeyer merged commit 78c91da into contao:master Jan 9, 2020
9 checks passed
9 checks passed
Coverage
Details
Coding Style
Details
PHP 7.2
Details
PHP 7.3
Details
PHP 7.4
Details
Prefer Lowest
Details
Bundles
Details
Windows
Details
codecov/project 89.73% (+0.03%) compared to 2aeda7f
Details
@leofeyer

This comment has been minimized.

Copy link
Member

leofeyer commented Jan 9, 2020

Thank you @rabauss.

leofeyer added a commit that referenced this pull request Jan 9, 2020
Description
-----------

Get the picker url parameters via own method, to get the possibility to overwrite/extend it in own extensions.

Sorry for the second PR, just didn't want to use my feature for filetree.
After #579 I just realized, that in pagetree is similar logic.

Commits
-------

85de3ad get picker url parameters via own method
7ed84e1 cs fix
c4935b1 Update core-bundle/src/Resources/contao/widgets/PageTree.php
leofeyer added a commit to contao/core-bundle that referenced this pull request Jan 9, 2020
Description
-----------

Get the picker url parameters via own method, to get the possibility to overwrite/extend it in own extensions.

Sorry for the second PR, just didn't want to use my feature for filetree.
After contao/contao#579 I just realized, that in pagetree is similar logic.

Commits
-------

85de3add get picker url parameters via own method
7ed84e1d cs fix
c4935b14 Update core-bundle/src/Resources/contao/widgets/PageTree.php
@rabauss rabauss deleted the eikona-media:feature/filetree branch Jan 9, 2020
Tastaturberuf pushed a commit to Tastaturberuf/contao that referenced this pull request Jan 13, 2020
Description
-----------

Get the picker url parameters via own method, to get the possibility to overwrite/extend it in own extensions.

Commits
-------

32e7023 get picker url parameters via own method
b719fcd cs fix
23f6055 Update core-bundle/src/Resources/contao/widgets/FileTree.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.