You are here

function enterprise_fields_prev_next_node in Enterprise Base 7.3

Field callback for previous/next buttons

Parameters

type $variables:

Return value

type

1 string reference to 'enterprise_fields_prev_next_node'
enterprise_fields_ds_fields_info in enterprise_fields/enterprise_fields.module
Implements hook_ds_fields_info().

File

enterprise_fields/enterprise_fields.module, line 129

Code

function enterprise_fields_prev_next_node($variables) {
  if (module_exists('prev_next')) {
    $entity = $variables['entity'];
    $next = prev_next_nid($entity->nid, 'next');
    $prev = prev_next_nid($entity->nid, 'prev');
    if (!empty($next) || !empty($prev)) {
      $output = '';
      if (!empty($next) && !empty($prev)) {
        return l(t('Next') . theme('icon', array(
          'bundle' => 'enterprise_base',
          'icon' => 'oeicon-right-open-big',
        )) . '<span class="arrow"></span>', 'node/' . $next, array(
          'html' => TRUE,
          'attributes' => array(
            'class' => array(
              'btn',
              'btn-primary',
              'next',
            ),
          ),
        )) . l(theme('icon', array(
          'bundle' => 'enterprise_base',
          'icon' => 'oeicon-left-open-big',
        )), 'node/' . $prev, array(
          'html' => TRUE,
          'attributes' => array(
            'class' => array(
              'btn',
              'btn-primary',
              'prev',
              'small',
            ),
          ),
        ));
      }
      elseif (!empty($next)) {
        return l(t('Next') . theme('icon', array(
          'bundle' => 'enterprise_base',
          'icon' => 'oeicon-right-open-big',
        )), 'node/' . $next, array(
          'html' => TRUE,
          'attributes' => array(
            'class' => array(
              'btn',
              'btn-primary',
              'next',
            ),
          ),
        ));
      }
      elseif (!empty($prev)) {
        return l(theme('icon', array(
          'bundle' => 'enterprise_base',
          'icon' => 'oeicon-left-open-big',
        )) . t('Previous'), 'node/' . $prev, array(
          'html' => TRUE,
          'attributes' => array(
            'class' => array(
              'btn',
              'btn-primary',
              'prev',
            ),
          ),
        ));
      }
    }
  }
}