You are here

alpha_pagination.install in Views Alpha Pagination 7.2

Alpha pagination update hooks.

File

alpha_pagination.install
View source
<?php

/**
 * @file
 * Alpha pagination update hooks.
 */

/**
 * Convert "pre_letter_path" option to "paginate_link_path".
 */
function alpha_pagination_update_7201() {
  alpha_pagination_migrate_option('alpha_pagination', 'pre_letter_path', 'paginate_link_path', function ($value, \views_handler $handler) {

    // Immediately return if there's no value.
    if (!$value) {
      return NULL;
    }

    // Convert any matching URLs to a token.
    if ($value === $handler->view->display[$handler->view->current_display]->handler
      ->get_url()) {
      $value = '[alpha_pagination:path]';
    }

    // Append a path separator, if necessary.
    if ($value[0] !== '#') {
      $value .= '/';
    }

    // Append the alphanumeric value token.
    $value .= '[alpha_pagination:value]';
    return $value;
  });
}

Functions

Namesort descending Description
alpha_pagination_update_7201 Convert "pre_letter_path" option to "paginate_link_path".