I just tried this module but I have no idea how to show the Like button. I went to its configuration page and enabled it on both full view and teaser view.

I'm using Display Suite module http://drupal.org/project/ds . And I dont see any fields related to FB like module, so i cant add it to my Layout.

I checked on Content Type edit page to see if there was a way of enabling this, and there's nothing.

Does anyone know for sure if this works with Display Suite or not?

Comments

doomed’s picture

Yeah, that's it. It's not compatible with the Drupal Suite.

I just confirmed with one of my content types that DO NOT use Display Suite and there it is the Facebook like button.

Too bad, i'll have to drop it.

doomed’s picture

Category: bug » feature

requesting as a feature

vidorado’s picture

Display suite can manage fields written to the node object by other modules, as Facebook Like Button does. Simply go to "Structure > Display Suite > Extras > Extra fields" and enable them. Then you have to add a field for each node type you want:

node|<your_node_type_1>|fblikebutton_field
node|<your_node_type_2>|fblikebutton_field
...

After that, you will have the new field in the "manage display" page.

Hope that helps!

pavimal’s picture

Hi i have the same problem. According to the solution #3 I don't see the Extras under Structure > Display Suite > where can i find it and how can we solve this problem?

Karel Bemelmans’s picture

Status: Active » Patch (to be ported)

I've added a display suite field for the dynamic facebook button. Now you get an extra field that you can position in your layout where you want the dynamic button.

Just add this code to the .module file:

/**
 * Implements hook_ds_fields_info().
 */
function fblikebutton_ds_fields_info($entity_type) {
  $fields = array();

  if ($entity_type == 'node') {
    $fields['dynamic_facebook_like_button'] = array(
      'title' => t('Dynamic Facebook Like button'),
      'field_type' => DS_FIELD_TYPE_FUNCTION,
      'function' => '_fblikebutton_dynamic_facebook_like_button',
    );

    return array('node' => $fields);
  }
  return $fields;
}

function _fblikebutton_dynamic_facebook_like_button($field) {
  $output = '';
  $url = url('node/' . $field['entity']->nid, array('absolute' => TRUE));
  $conf = array(
    'layout' => variable_get('fblikebutton_bl_layout', "standard"),
    'action' => variable_get('fblikebutton_bl_action', "like"),
    'color_scheme' => variable_get('fblikebutton_bl_color_scheme', "light"),
    'show_faces' => variable_get('fblikebutton_bl_show_faces', "false"),
    'font' => variable_get('fblikebutton_bl_font', "arial"),
    'height' => variable_get('fblikebutton_bl_iframe_height', '80'),
    'width' => variable_get('fblikebutton_bl_iframe_width', '450'),
    'other_css' => variable_get('fblikebutton_bl_iframe_css', ''),
    'language' => variable_get('fblikebutton_bl_language', 'en_US'),
  );

  $output = _fblikebutton_field($url, $conf);
  return $output;
}

It's probably also good to write a get_settings() function as too many functions build up the same configuration variable now, but that's outside the scope of this issue ;)

lliss’s picture

Status: Patch (to be ported) » Needs review

Looks good. Anyone tested this yet?
Also, totally agree about the get settings function.

jonhattan’s picture

Title: Display Suite compatiblity » Display Suite integration
Version: 7.x-1.2 » 7.x-2.x-dev
Component: User interface » Code
FileSize
2.76 KB

Removed _bl_ in the variable names and converted it into a patch against 7.x-2.x.

I suggest to refactor the population of $conf = array(...) to a factory in a follow up issue.

This implementation is working nice. Not RTBC'ing it since I'm attaching a patch here.

lliss’s picture

I'm having trouble seeing how this is supposed to work. I might need to read up on display suite a bit more. In the meantime can you give a rundown of how to test this? The display suite settings are kind of all over the place and switching the radios at
admin/config/fblikebutton/dynamic
alters what options are available.

jonhattan’s picture

FileSize
3.07 KB

Here's a new patch including several improvements.

jonhattan’s picture

FileSize
138.05 KB
121.66 KB

To see it working you need to enable ds and ds_ui and follow the steps in the attached screenshots:

1. go to admin/structure/types/manage/CT/display and make it ds aware by choosing a ds layout.

2. you will see the ds field for fblikebutton available (ds fields are presentation only, that is, only available in "Manage display")).

Note the field is only available for content types with fblikebutton enabled.

Also, working with ds makes those settings unnecessary:

* Where do you want to show the Like button (full node view)?
* Where do you want to show the Like button on teasers?

lliss’s picture

Thanks for the great work on this. I've added this to the module.

lliss’s picture

Status: Needs review » Reviewed & tested by the community
jonhattan’s picture

I don't see this added to the module :)

Do you want me to reroll the patch over 7.x-2.x-themeable branch?

lliss’s picture

It's in the 7.x-2.x-dev version that is dated 14 Nov. And as always in git. Please check again.

jonhattan’s picture

Status: Reviewed & tested by the community » Fixed

You're absolutely right. Thanks!

Status: Fixed » Closed (fixed)

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