diff --git a/core/includes/pager.inc b/core/includes/pager.inc index a787778..3a7c592 100644 --- a/core/includes/pager.inc +++ b/core/includes/pager.inc @@ -67,10 +67,11 @@ function pager_find_page($element = 0) { * // render array. * $offset = $num_per_page * $page; * $result = mymodule_select("SELECT * FROM data " . $where . " LIMIT %d, %d", $offset, $num_per_page)->fetchAll(); - * $render = [[ + * $render = []; + * $render[] = [ * '#theme' => 'mymodule_results', * '#result' => $result, - * ]]; + * ]; * * // Finally, add the pager to the render array, and return. * $render[] = ['#type' => 'pager']; @@ -96,11 +97,12 @@ function pager_find_page($element = 0) { * pager_default_initialize($result->total, $num_per_page); * * // Create a render array with the search results. - * $render = [[ + * $render = []; + * $render[] = [ * '#theme' => 'search_results', * '#results' => $result->data, * '#type' => 'remote', - * ]]; + * ]; * * // Finally, add the pager to the render array, and return. * $render[] = ['#type' => 'pager']; @@ -282,21 +284,18 @@ function template_preprocess_pager(&$variables) { } /** - * Get the query parameter array of a pager link. + * Get the URL query parameter array of a pager link. * - * Adds or adjusts the 'page' parameter to make sure that, following the link, - * the requested page for the given element is displayed. - * The 'page' parameter is a comma-delimited string, where each value is the - * target page for the corresponding pager $element. - * Since we can have multiple pagers on a single page, each pager has an - * element value assigned to it. If we have 5 pagers on a single page, we could - * assign them the element numbers: 0, 1, 2, 3, 4. To indicate that the 3rd - * pager needs to jump to page page 5 (note that in the pager query, the page - * numbers are zero-indexed, i.e. page at index 5 means that the pager will - * display page 6 to the users), we would need to indicate this in the URL - * query, by having element 2 have the index of 5. The URL query would then - * look like this, supposing all other pagers are on page index 0: - * ?page=0,0,5,0,0. + * Adds or adjusts the 'page' URL query parameter to make sure that, following + * the link, the paged content indicated by $index for the given pager $element + * gets displayed. + * + * The 'page' URL query parameter is a comma-delimited string, where each value + * is the target content page for the corresponding pager $element. For + * instance, if we have 5 pagers on a single page, and we want to have a link + * to a page that should display the 6th content page for the 3rd pager, and + * the 1st content page for all the other pagers, then the URL query will look + * like this: ?page=0,0,5,0,0 (page numbering starts at zero). * * @param array $query * An associative array of query parameters to add to.