Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The associative array returned by _amp_get_amp_js() does not include amp-social-share, which prevents using _amp_add_component_libraries() to include that custom element. Even though the signature states the intent of the latter function being a private implementation, it's quite reasonable to call it directly from a module/theme that is fully tied to amp functionality and prevent duplicating all the code needed to inject the full script tag.
Comment | File | Size | Author |
---|---|---|---|
#2 | amp_social_share-2768631-02.patch | 706 bytes | jedihe |
Comments
Comment #2
jedihe CreditAttribution: jedihe as a volunteer commentedPatch attached.
Also a quick comment: it'd be great if the function itself can be renamed to be public (e.g. amp_add_component_libraries()), since it's quite useful and calling it multiple times won't cause issues like duplication of custom elements.
Comment #3
jedihe CreditAttribution: jedihe as a volunteer commentedComment #4
laxman.ghavte CreditAttribution: laxman.ghavte as a volunteer and at Faichi Solutions Pvt Ltd for Faichi Solutions Pvt Ltd commentedPatch looks good to me.
Comment #6
mtiftCommitted and pushed to 7.x-1.x. Thanks guys!
Comment #8
alexseif CreditAttribution: alexseif commentedI applied this patch, but I cannot get the social share to work, it doesn't detect the amp-social-share tag to load the appropriate js, I just added this to a custom field