- Issue created by @lennart
- 🇸🇮Slovenia slogar32
Thanks for the nice feedback. If the Pixabay API supports it, It's possible, of course. But as I am currently very busy in my private life, I don't see it happening anytime soon, if I would have to implement it, sorry. Maybe someone from the open source community will see this feature request and jump in, hopefully.
- First commit to issue fork.
Looking at the Pixabay API, they don't return the license, however, we get the original post URL. So we can save that information.
When it comes to the license, all Pixebay content is under their Content License. So you can use that URL on your page if you want to display the license or even their License Summary.- Merge request !5Resolve #3400072 "Get link to image on pixabay or license" → (Merged) created by admirlju
- Status changed to Needs review
about 1 year ago 1:51pm 20 November 2023 I've implemented saving a URL to the image page, on the media type image. Using Field Mapping in the media type config, you can pick a field (at the moment I limited it to field type link) to which it will save the URL to the original image page.
So steps to use:
- Go to /admin/structure/media
- Manage fields for Image
- Create a new field of type Link
- On the Image edit page, under Field Mapping > Pixabay URL select the newly created field
- Any newly added image from Pixabay will automatically set the URL and Original image as title
This way you can also modify the field display, however you want to, using Manage Display.
- 🇩🇰Denmark lennart
Thank you both very much. Can I help test this?
Yes of course. Honestly testing as much as possible would be very useful, there might be edge cases I didn't think of when developing.
- 🇩🇰Denmark lennart
I think there used to be a "patch" one could apply to test these sorts of things.
How do I test a pull request? (Sorry, not a programmer)
If you find patching easier, you can generate a patch on the merge request page. So on the merge request page, if you click the button "Code", you'll see the patches option under Download. This will download a patch file, that you can apply.
- 🇮🇳India Vivek Panicker Kolkata
@admirlju Changes look good.
I applied the patch, followed your instructions and created the content.
When I edit the particular media I see the following:It looks a bit out of place since it appears in the bottom of the page below the save button.
Can we fix that?Also shouldn't we document the steps in the README file?
Hi, so this is the default behavior of entity type form display when you add a new field. And how it currently works it's probably an issue somewhere in the Drupal core.
If you want to move the links above the save and delete buttons.
- Edit the media type.
- Go to Manage Form Display
- Move the Link field just below the image field
- Save changes
Yeah, I agree about the README. I'll add the steps to it. I just first wanted to make sure it works like it's supposed to.
- Status changed to Needs work
12 months ago 9:16am 29 November 2023 - 🇸🇮Slovenia slogar32
Hey! Thank you for the feature implementation. I quickly went through the changes, could you please:
- -Make the pixabay URL field map available on all media types with the image source plugin (since the module supports adding of those on the entity browser widget). Use
$sourcePlugin = $entity->getSource(); if (!$sourcePlugin instanceof (Drupal\media\Plugin\media\Source\)Image) { return; }
instead of
if ($entity->id() != 'image') { return; }
in the form alter hook, that you've implemented.
- -Use camelCase for the newly defined
$pixabay_url_field_name
variable in the Pixabay plugin class please (I know $form_state is snake case, but we used camel case throughout the whole class, so it should stay consistent). -
-Run
hpcs --standard=Drupal,>DrupalPractice
to see if your code follows Drupal coding standards. Add the "." to the end of the inline comments in the form alter hook, that's what I spotted with my eyes, maybe there's more to fix.
Otherwise, this looks good!
- -Make the pixabay URL field map available on all media types with the image source plugin (since the module supports adding of those on the entity browser widget). Use
- First commit to issue fork.
- Status changed to Needs review
12 months ago 10:45am 29 November 2023 - 🇮🇳India ankithashetty Karnataka, India
Updating MR with changes requested in #13. Thanks!
- Assigned to slogar32
-
slogar32 →
committed 31531bdf on 3.0.x authored by
admirlju →
Issue #3400072 by admirlju, slogar32: Get link to image on pixabay or...
-
slogar32 →
committed 31531bdf on 3.0.x authored by
admirlju →
- Issue was unassigned.
- Status changed to RTBC
9 months ago 9:45am 1 March 2024 - 🇸🇮Slovenia slogar32
I tested this with multiple widgets (with each having a different media type with an image source plugin selected). I had to add some edge cases and fix the code quality slightly. I've also updated the readme file. Thank you for your contributions.
- Status changed to Fixed
9 months ago 9:45am 1 March 2024 - 🇮🇳India Vivek Panicker Kolkata
@slogar32 Hi!
It seems neither me or @ankithashetty received any credit for this :| - 🇸🇮Slovenia slogar32
Hello!
I've assigned credit to this issue, according to How is credit granted for Drupal core issues → . @admirlju got credit because he created the initial solution, @lennart got credit, because of a useful original issue report (see first two bullet points here https://www.drupal.org/about/core/policies/maintainers/how-is-credit-granted-for-drupal-core-issues#receive-credit → ).
I did not grant you credit because of bullet point 7, 2nd level bullet point 3 here https://www.drupal.org/about/core/policies/maintainers/how-is-credit-granted-for-drupal-core-issues#not-receive-credit → and @ankithashetty, because she did copy paste of my code from the comment, and she also missed some obvious things of the same matter from her copy paste fixes, that I had to fix myself later on (could fall under bullet point number 9 from the last link).
So basically I had to re-test this whole solution again, and I found further issues, that I also fixed myself. And because of the described things above, I do not see you eligible for credit here, sorry.
Best regards,
Domen Automatically closed - issue fixed for 2 weeks with no activity.