Hy!
I would like a possibility in the UI where I input the pager link titles an override it:

  • << first
  • < previous
  • next >
  • last >>

Is this possible?

Also what would be great yet --> add a icon/image to or instead of the link titels :-)

Comments

mondrake’s picture

Hi Bernsch,

and thank you for your interest in Pagerer.

I would like a possibility in the UI where I input the pager link titles an override it:

<< first
< previous
next >
last >>
Is this possible?

You can do that in coding, calling directly the theme functions and passing the needed 'tags' array variable. More info here.
But, not through the admin UI, sorry, not at this stage. This is something I have been thinking about, but I would like the text strings to be translatable for multilingual sites and for the time being I have no clear mind on how to achieve that.
If anyone has ideas, or even better, can contribute developing a patch, it will be very welcome.

Also what would be great yet --> add a icon/image to or instead of the link titels :-)

This is something you can do with CSS styling. A good explanation is in #583044: Custom Arrows, which in fact refers to the Minimax pager module for Drupal6. But the class names used are the same in D7, so the concept is still valid.

Bernsch’s picture

And how can i override this theme function in pagerer.module file in my template.php?

function _pagerer_tags_merge_default($theme, $display_mode, $tags = NULL) {
  switch ($theme) {
    case 'pagerer_standard':
      $default_tags = array(
        'page'             => t("@number"),
        'first'            => t("« first"),
        'previous'         => t("‹ previous"),
        'next'             => t("next ›"),
        'last'             => t("last »"),
        'total'            => t("of @total"),
        'page_label'       => t("Page"),
        'item_label'       => t("Item"),
        'item_range_label' => t("Items"),
      );
      break;

    default:
      $default_tags = array(
        'page'             => t("@number"),
        'first'            => t("«"),
        'previous'         => t("<"),
        'next'             => t(">"),
        'last'             => t("»"),
        'previous_progr'   => t("-@number"),
        'next_progr'       => t("+@number"),
        'total'            => t("of @total"),
        'page_label'       => t("Page"),
        'item_label'       => t("Item"),
        'item_range_label' => t("Items"),
      );
      break;

  }
  switch ($display_mode) {
    case 'pages':
      $default_titles = array(
        'page_title'     => t("Go to page @number"),
        'first_title'    => t("Go to first page"),
        'previous_title' => t("Go to previous page"),
        'next_title'     => t("Go to next page"),
        'last_title'     => t("Go to last page"),
        'widget_title'   => t("Enter page, then press Return."),
        'slider_title'   => t("Drag the handle to the page required."),
      );
      break;

    case 'items':
      $default_titles = array(
        'page_title'     => t("Go to item @number"),
        'first_title'    => t("Go to first item"),
        'previous_title' => t("Go to previous items"),
        'next_title'     => t("Go to next items"),
        'last_title'     => t("Go to last items"),
        'widget_title'   => t("Enter item, then press Return."),
        'slider_title'   => t("Drag the handle to the item required."),
      );
      break;

    case 'item_ranges':
      $default_titles = array(
        'page_title'     => t("Go to items @number"),
        'first_title'    => t("Go to first items"),
        'previous_title' => t("Go to previous items"),
        'next_title'     => t("Go to next items"),
        'last_title'     => t("Go to last items"),
        'widget_title'   => t("Enter item, then press Return."),
        'slider_title'   => t("Drag the handle to the item required."),
      );
      break;

  }
  $default_titles['slider_tickmark_title'] = "Then, click on the tickmark.";
  $default_tags += $default_titles;
  if ($tags) {
    return array_merge($default_tags, $tags);
  }
  else {
    return $default_tags;
  }
}
mondrake’s picture

Hi,

you do not need to override that - that function is there to set default values if the 'tags' array does not contain values already.

What you can do is implement in template.php a hook_preprocess_pagerer_xxxx() to set the 'tags' values you need. xxxx should be replaced with the specific pagerer theme you want to address.

Example:

function mytheme_preprocess_pagerer_mini(&$variables) {
  $variables['tags']['first'] = t('foo');
  $variables['tags']['previous'] = t('bar');
  $variables['tags']['next'] = t('baz');
  $variables['tags']['last'] = t('qux');
}
Bernsch’s picture

Oh OK! Thank you! It works fine :-)
Can you write the example-code in your documentation site pleace?!
lg, bernsch

mondrake’s picture

Title: override pager link title » Override pager text elements

Good idea. I will make a reference to this when releasing version 1.1.

I am leaving this issue active anyway, since at one point I would still like to have a admin UI solution for this.

mondrake’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Active » Postponed

It looks like that in Drupal 8, after converting pagerer presets to configuration entities, it will be possible to use the config_translation module to translate the configuration in multilanguage sites. So an admin UI to edit the 'tags' array will be implemented on the D8 version.

mondrake’s picture

Issue summary: View changes

add text: Also what would be great yet --> add a icon/image to or instead of the link titels :-)

mondrake’s picture

Issue summary: View changes
Status: Postponed » Fixed

Changing the text elements of the pager through the UI is now implemented in the Drupal 8 version of the module, in the development branch.

Status: Fixed » Closed (fixed)

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

markusd1984’s picture

#4 worked a treat in a custom module but that customisation in the UI would be easier, especially for the popular slider :) Love this module!