I've tried this module, to show a pager and cycle trought a list of node.
But I've noticed it's not compatible with display suite, the great node display modules suite.

The pager isn't exposed to display suite and can't be displayed when using this module.

Per aps it'll be not to difficult to expose the pager to display suite?

CommentFileSizeAuthor
#4 custom-pagers-1177912-4.patch1.56 KBphenaproxima
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sw3b’s picture

Try create a custom pager in a block style instead attaching it to a node type, then in display suite create field block. This is a good workaround, and in display suite you can do what ever you want after.

This is what i'm doing for my gallery nodes and it's working great.

mrP’s picture

this is a great workaround for D7 as well.

@sw3b thanks a ton.

phenaproxima’s picture

Issue summary: View changes

I found another way to work around this in D7, without having to do extra configuration.

Here's some code, which you can add to a custom module (just replace "MODULE" with the name of your module) which will expose custom pagers as preprocess fields in Display Suite.

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

  if (module_exists('custom_pagers') && $entity_type == 'node') {
    $pagers = _custom_pagers_load_all_pagers();
    
    foreach ($pagers as $pager) {
      $info = array();
      $info['title'] = $pager->title;
      $info['field_type'] = DS_FIELD_TYPE_PREPROCESS;
      $info['ui_limit'][] = "{$pager->node_type}|*";
      $fields['node']["custom_pager_{$pager->pid}"] = $info;
    }
  }
  
  return $fields;
}

/**
 * Implements template_preprocess_node().
 */
function MODULE_preprocess_node(array &$variables) {
  if (isset($variables['content']['custom_pager_top'])) {
    MODULE_add_custom_pagers($variables, $variables['content']['custom_pager_top']);
  }
  if (isset($variables['content']['custom_pager_bottom'])) {
    MODULE_add_custom_pagers($variables, $variables['content']['custom_pager_bottom']);
  }
}

function MODULE_add_custom_pagers(array &$variables, $pagers) {
  foreach (element_children($pagers) as $id) {
    $variables["custom_pager_{$id}"] = $pagers[$id]['#markup'];
  }
}

This has the added benefit of being an easy patch that could be added to custom_pagers.

phenaproxima’s picture

Version: 6.x-1.0-beta2 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
1.56 KB

Patch for 7.x-1.x-dev attached.