I couldn't figure out if this fitted under any of the existing issues so I am raising a new one.

I have also assigned it to version 6.x-2.0-beta4, which is where I first noticed the problem. The problem is also present in version 6.x-2.x-dev.

Our problem was with the positioning of the facebook comment block. With only one preset (comment) defined , the facebook comment block displayed where we wanted it to appear and it was listed in content types->field management, allowing it to be repositioned. As soon as we added a second preset, the comment block landed at the top of the node display and the entry in content types->field management disappeared.

There is a problem in the content_extra_fields hook... fbsocial.module, function fb_social_content_extra_fields is called for each Drupal content type and loops through all presets, invoking the chaos tools 'content_extra_fields' hook in the plugin file associated with each preset. On return from the plugin's hook function, the return value is assigned to array variable $extras. This is incorrect.

The return value should first be tested to ensure it is a non-empty array and should then be appended to the $extras array. The extra_fields hook routines in each plugin will always return an array - either an empty array, or an array loaded with appropriate values if that preset is configured to display for the current Drupal content type. However, the main hook function as currently implemented will only ever return one array element - whatever was returned by the last plugin hook called.

In fbsocial.module therefore, the code

 * Implementation of hook_content_extra_fields.
function fb_social_content_extra_fields($type_name) {
  $extras = array();
  if ($presets = fb_social_get_presets()) {
    foreach ( $presets as $preset ) {
      $plugin = fb_social_fb_plugin_load($preset->plugin_type);
      $function = ctools_plugin_get_function($plugin, 'hook_content_extra_fields');
      if ($function) {
        $extras = $function($preset, $type_name);
  return $extras;

needs to change to something like

      $function = ctools_plugin_get_function($plugin, 'hook_content_extra_fields');
      if ($function) {
        $extra = $function($preset, $type_name);
        if (is_array($extra) && count($extra))
          $extras = array_merge($extras, $extra);

This modification fixed our positioning problem with the facebook comments block and also seems to have restored the facebook comment block entry in content types->field management.

#1 fb_social-1621426-content_weight.patch706 bytespfournier
Members fund testing for the Drupal project. Drupal Association Learn more


pfournier’s picture

Here is a patch for this.

pfournier’s picture

Issue summary: View changes

A correction to my erroneous correction so that the fix also works for the field list in content types->field management