This is a relatively small use case, but might make the current integration easier.

Have a theme function where you can pass through variables for title, link, text, etc. and return with a button you can add to anything programmatically. The use case here is on a site of ours we have several "highlight videos" that are youtube embed fields. We would like to add a share button to each of these where the user can share the youtube video links with their friends. Since it is on a field, we would have to do it within a preprocess function on our theme.

Why it could help: Making the creation of the share button more drupal-y... and a single call that can be used throughout to run the entire process.

Comments

iamcarrico’s picture

Here is my go at this, and it pulls in parts of #1789232: Update theming of sign-on to use renderable arrays, to better enhance themability. and #1789218: Add in ability to change the text / icons for the social sharing widget. within it to have more broad theming capabilities. I think there can still be some more work on making it more open, but this alone will help overall usage greatly.

A few notes:

  • I moved all the js including into the theme functions so that it can be used by theme's to implement custom "Share" buttons.
  • Changed the method of adding in some of the buttons, again for better themeing
  • Allowed each share button to be added individually.
  • I assume "rpx_social_pub" is on the workflow to be set somewhere else? I left it alone, but allowed it to be nothing and not produce empty spans.
  • I added in the ability to remove the icons from the script.
iamcarrico’s picture

Also includes code to help with #1789214: Share widget does not display icons, but does not solve the problem.