Hi. Most of the existing social share modules works with views.
modules like service links, facebook share and a few others can work with views.

Using views to display buttons can be useful if you have special visibility rules or special view pages.
It also offer you to have custom display styles for each view you create.
Views can also be used as panels, making panel integration easy, especially on contextual url's

Thanks

CommentFileSizeAuthor
#9 rrssb-views-2245351-9.patch1.96 KBkarlshea

Comments

mike.roberts’s picture

What kind of views integration would you like to see? A views field, which can be added to each views row? That seems like it could be pretty handy, I'll look into it. Probably won't have time to finish this for a 1.0 release, but could possibly make it into a 1.1 or 1.2 release.

If you want to contribute patches or code suggestions that would be awesome as well!

vlooivlerke’s picture

Hi, A view field would be perfect. It can have the same options as the block. Also putting it in a row means you can have it an a teaser view.

mike.roberts’s picture

Version: » 7.x-1.x-dev

You can already use this in the teaser view of your nodes. There is a "field" under manage display where you can choose to show or hide for each view mode of the node.

That said I still think views integration could be a good idea as the module matures, so I'll leave this open for a future release.

mike.roberts’s picture

Status: Active » Postponed
hiplus’s picture

Hi iam not sure if i post at the right section. is it posible hide rrssb in node.tpl.php and then print it in another region in node.tpl.php?

thank you in advance

mike.roberts’s picture

You are not posting in the correct section but I'll answer anyway :-P.

You can accomplish this in a number of ways. You can rearrange it on the manage display page and put the buttons in a certain place based on field order.

OR you can do this through writing your own node.tpl.php file in your theme. You can use php's hide() function to hide the buttons when the content is first rendered. Then render the buttons later on. Or if you want buttons at the top, you can render the buttons individually, then hide them and render $content.

For more info on how to do this, check out https://api.drupal.org/api/drupal/modules%21node%21node.tpl.php/7

hiplus’s picture

Thank you very much for your answer. Yes i find how to hide and print again.

print render($content['rrssb']);
adamps’s picture

Title: A views formatter » Add views field for RRSSB buttons
Version: 7.x-1.x-dev » 8.x-2.x-dev
Status: Postponed » Active

I would accept a patch for 8.x-2.x. (Could also backport to 7.x-2.x.)

karlshea’s picture

Status: Active » Needs review
StatusFileSize
new1.96 KB

Views field plugin patch

adamps’s picture

Thanks for the patch. Hopefully I will have time to fix some outstanding issues and create a new release sometime in November.

adamps’s picture

Status: Needs review » Fixed

Patch is good thanks. I made two small changes.

1) Buttons can be share or follow so let's say "social buttons"

--- a/rrssb.views.inc
+++ b/rrssb.views.inc
@@ -13,7 +13,7 @@ function rrssb_views_data_alter(array &$data) {
     'title' => t('RRSSB Buttons'),
     'field' => [
       'title' => t('Ridiculously Responsive Social Share Buttons'),
-      'help' => t('Show a share button set.'),
+      'help' => t('Show a social button set.'),
       'id' => 'rrssb_buttons',
     ],
   ];

2) Wrong cache context as buttons do not depend on the URL of the current page.
<?php
--- a/src/Plugin/views/field/RRSSBField.php
+++ b/src/Plugin/views/field/RRSSBField.php
@@ -49,7 +49,7 @@ class RRSSBField extends FieldPluginBase {
    * {@inheritdoc}
    */
   public function render(ResultRow $values) {
-    return rrssb_get_buttons($this->options['button_set'], $values->_entity, 'url.path');
+    return rrssb_get_buttons($this->options['button_set'], $values->_entity);
   }

 }

adamps’s picture

  • b41316f committed on 8.x-2.x
    Issue #2245351 by KarlShea, AdamPS: Add views field for RRSSB buttons
    
adamps’s picture

I made two more small changes based on my final checks/tests

  • Button set field should be #required
  • Switch to use modern array syntax [] instead of array()

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.