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

Media Galleries: widget location doesn't make sense #2569

Open
Katrienvh opened this Issue Jun 18, 2018 · 13 comments

Comments

Projects
None yet
4 participants
@Katrienvh
Contributor

Katrienvh commented Jun 18, 2018

Type

  • Non critical bug

Problem description

The explenation in fork:

As a developer, you can add your own custom widgets by adding them in the folder /src/Frontend/Modules/MediaLibrary/Widgets/. Each widget that you add gets added in this dropdown automatically and can have its own image sizes in the Frontend.

Why are media gallery widgets added to the media library??? it doesn't make sense!

@Katrienvh Katrienvh changed the title from Media Galleries: add custom widget does not work to Media Galleries: widget location doesn't make sense Jun 18, 2018

@jeroendesloovere

This comment has been minimized.

Member

jeroendesloovere commented Jun 18, 2018

I use this every time and it works...
Can you tell me exactly what you did?

@Katrienvh

This comment has been minimized.

Contributor

Katrienvh commented Jun 18, 2018

I updated my issue

@jeroendesloovere

This comment has been minimized.

Member

jeroendesloovere commented Jun 18, 2018

I'm sorry, but I don't understand.
Can you give a little more information please.

@jeroendesloovere

This comment has been minimized.

Member

jeroendesloovere commented Jun 18, 2018

Ah you probably mean, why you must put your "custom media library widgets" in the "MediaLibrary" and not in the "MediaGalleries" directory.

@jeroendesloovere

This comment has been minimized.

Member

jeroendesloovere commented Jun 18, 2018

Well that is easy to say. MediaLibrary is the "core", the module where everything is connected to.
Which means, that if you add such a custom widget to the media library, you can use it from any other module... Not just from MediaGalleries.

@carakas

This comment has been minimized.

Member

carakas commented Jun 18, 2018

@jeroendesloovere before you close the issue first check with @Katrienvh if that answer solves the issue for her

@StijnVrolijk

This comment has been minimized.

Contributor

StijnVrolijk commented Jun 18, 2018

@jeroendesloovere isn't the entire point of the MediaGalleries module to have several ways to display media stored in the MediaLibrary module?

Imo there's a conflict of responsibilities here.
MediaLibrary's only responsibility should be to store and manage media, not decide how it gets displayed. Therefor having widgets in the MediaLibrary is inherently incorrect, I think.

I get where you're coming from, but I think other modules should access the MediaGalleries module to add media widgets to themselves, not the MediaLibrary module.

@Katrienvh

This comment has been minimized.

Contributor

Katrienvh commented Jun 18, 2018

I agree with stijn, that other modules should access the MediaGalleries module not Media Library, that make more sense to me

@jeroendesloovere

This comment has been minimized.

Member

jeroendesloovere commented Jun 18, 2018

@StijnVrolijk & @Katrienvh

MediaGalleries module

The MediaGalleries module is just build as an example module to show everybody how you can implement the MediaLibrary MediaGroup and how to use MediaGroupType in a symfony form.
So everybody can see how to integrate MediaLibrary in their custom modules (blog, news, jobs, whitepapers, downloads, realizations, projects, banners, ...).

Solution for your question

I do made it possible for everybody to place "custom widgets" in "their own custom modules directories".
Hereby I refer to the $module declaration in the Twig media_library_widget method https://github.com/forkcms/forkcms/blob/master/src/Frontend/Modules/MediaLibrary/Twig/Extensions/FrontendHelperExtensions.php#L45

What needs to be changed in Backend:
So we could make "small modifications" to the "MediaGalleryAdd/Edit" dropdown to find "custom widgets" in the "/src/Frontend/Modules/MediaGalleries/Widgets" (and not only in the MediaLibrary directory).

What needs to be changed in Frontend:
When calling parseWidget here we just add "MediaGalleries" as the fourth parameter.

MediaLibrary widgets

But I insist that the default media library widgets remain on their place in the MediaLibrary module, since that is the "core" for everything (and MediaGalleries is just an example module).

@carakas

This comment has been minimized.

Member

carakas commented Jun 18, 2018

@jeroendesloovere can you use the widgets in the media library without installing the media gallery?
If so can you give us an example of this

@jeroendesloovere

This comment has been minimized.

Member

jeroendesloovere commented Jun 18, 2018

@carakas Yes, off course you can. That is the entire principle of the Media Library.

I strongly advice you guys read this documentation page
https://github.com/forkcms/forkcms/blob/master/docs/07.%20media%20library/03.%20integrating%20in%20your%20module.md

@jeroendesloovere

This comment has been minimized.

Member

jeroendesloovere commented Jun 19, 2018

@StijnVrolijk, @Katrienvh & @carakas
Is everything clear?

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