Closed (fixed)
Project:
Social Share
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Mar 2018 at 15:57 UTC
Updated:
19 Oct 2024 at 04:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
Knud Frank commentedHere is a patch to solve the issue.
Comment #3
fagoThanks for the patch. Here a few remarks:
>The URL for PDF document.
for *the* PDF document
>+ * id = "link_PDF",
IDs should be all lowercase. Same for print.
>The text of the Print link."),
a print link is not a special thing, so let's keep spelling it all lowercase "print link" in sentences. Thus "Print" should be lowercased "print" in sentences everywhere.
>+ * description = @Translation("The URL for Print. When set to '<current>', the current page's URL is used."),
Can be default imo.
>the current page's URL is used.
I think that's wrong. It uses only the current page's path, not the full URL, or does it? Are present query paramters kept, shoudl they be kept? Let's be precise here.
>+{{ attach_library('social_share/popup') }}
I don't see why PDFs would open in a popup dialog. Let's use target blank, but no popup. Probably same for others.
I dislike that complexity in the template + it seems to be unnecessary complex:
Query parameter should be passed to the $options parameter of the url function, see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for docs of the options. I think you can just split the string by & and it should be fine.
Should be called "pdf_url_query" - or url query parameter but that would be come a bit long.
Label: "PDF document URL query parameter"
Description: Some query parameters to append to the PDF document URL. Multiple values can be separated by ampersands (&).
Same for print parameters.
Comment #4
Knud Frank commentedAdjusted all files with regard to the comments from fago.
Comment #5
fagoComment #6
fagoLet's move this logic in the preprocessors, it does not make much sense to do this in the template.
Also what's app has a popup left, what we do not need.
Comment #7
Knud Frank commentedLogic moved to preprocessor.
Removed popup from WhatsApp template.
Comment #8
Knud Frank commentedComment #9
Knud Frank commentedCorrected file. Please disregard patch 7.
Comment #10
fagoouch, no globals please - there must be some API to achieve what you need. Like \Drupal::request()->getRequestUri() or \Drupal::request()->getUri()
No guessing, please - this can create troubles. Please only processes a fixed list of url properties.
+{% set url = url|default(url('<current>')|render|striptags) %}Should be removed and rely on the URL variable being preprocessed now. Same for "+ 'url': url|default(url('')|render|striptags)," of course.
Comment #11
Knud Frank commentedAbsolute URL can be achieved with
\Drupal::request()->getUri().Processed only the fields url and twitter_url to avoid troubles with other fields.
URLs are no longer set in Twig templates as code has benn moved to preprocess function.
Comment #12
fagoThis will miss things when the field formatter is used :(
Let's just add a custom preprocess function like "social_share_preprocess_template_urls"
>$info['preprocess functions'][] = 'social_share_preprocess_template_urls';
Comment #13
Knud Frank commentedAdded a custom preprocess function.
Comment #14
siva01 commentedLast patch social_share-whatsapp_print_pdf-2954288-13.patch hasn't defined WhatsApp message and url_params in twig message. There is update.
Comment #15
vandna b commented#14 working fine for me.
Comment #16
a.milkovsky#14 works good, but it removes the PrintShareLink.
Comment #17
a.milkovskyFixed #14, added missing files like PrintShareLink.php.
Comment #18
a.milkovskyFixed the function duplication.
Comment #19
a.milkovskyLast patch contained file duplicates. Fixed it.
Comment #20
a.milkovskyHey, @Knud Frank let's RTBC and commit this feature/
Comment #21
ckohl commentedThis patch fixes the "context_definitions" annotation
Comment #22
michaellenahan commentedThis patch provides drupal 10 compatability, following on from https://www.drupal.org/project/social_share/issues/3378493
Comment #23
michaellenahan commented#22 patch was incomplete, here is the correct patch.
Comment #24
michaellenahan commentedComment #25
michaellenahan commentedSorry for the noise. Here is the patch for drupal 10, including the changes from here: https://www.drupal.org/project/social_share/issues/3378493
Comment #26
tienwang commentedD10 patch (including the tweak for PrintShareLink.php)
Comment #29
volkerk commentedAdd patch for project installs.
Its same as social_share-whatsapp_print_pdf-2954288-26.patch but catering to typed_data update, see also #3461912: Fatal error on upgrade of typed_data dependencies
Comment #30
daniel.bosenThe concerns in #2954288-12: Support for WhatsApp, Print and PDF documents are addressed, the code looks good and this is actually running for 6 years in our projects. This looks good to me :-)
Comment #32
fagoThis seems fine indeed. Let's finally move on here ;-)
Comment #33
fago