If a node has a URL alias, the full path is lost when paging forward.
For example. If URL is:
http://domain.com/this_path/that_path
When I just to 2nd page with Pagerer I get:
http://domain.com/node/1593?page=1
I'm expecting (as happens with the Drupal pager):
http://domain.com/this_path/that_path?page=1
===================
I'm using the Pagerer Slider, if that makes any difference. By the way, I like this module very much. Nicely done! So I hope you can fix this.
John
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 2681381-16.patch | 513 bytes | mondrake |
Comments
Comment #2
mondrakeThank you!
Can you add detailed steps to reproduce the bug? i.e. how does the pager get on a node URL
Comment #3
mondrakeComment #4
jnimchuk commentedSorry, didn't see your request until now (didn't get an email).
1. I have a view that I access from my menu.
2. On the first page, URL displays the proper alias.
3. But when I click pagerer to go to second page, URL alias is lost.
Try it yourself at:
http://test8.portrevolt.com/images/gallery/american_artists/rembrandt_peale
Comment #5
mondrakeThank you.
Looking at your link source, I can see that the JS drupalSettings.currentPath variable is set to "currentPath":"node\/1593".
Since the JS enabled Pagerer widgets use that variable to build the link "on the fly" on the client, this one may be the culprit. This may however be a Drupal core issue, since that variable is set by the core framework.
I could reproduce this by:
node/1test/testhttp://[mysite]/test/test"currentPath":"node\/1"where you would expect"currentPath":"test\/test"I will create a core issue for this.
Still, a couple of questions:
Comment #6
mondrakeCreated #2687453: drupalSettings.path.currentPath refers to the route's URL even when page is accessed through an URL alias in Drupal core issue queue.
Comment #7
jnimchuk commentedHi Mondrake -
1. It was very easy to export a view in Drupal 6; don't see how to do it in Drupal 8. Sorry.
I'm not sure I understand your question about the view; I'm not using a module. Basically I have created a set of views which work together to create a gallery. Start here, and then click on Rembrandt Peale and you'll see what I mean.
http://test8.portrevolt.com/images/gallery
Comment #8
mondrakeYou can do that visiting Manage > Configuration > Development > Configuration Synchronization and exporting a single item, 'configuration type' = 'View' and 'configuration name' = your view's name.
My question is that you have a URL http://test8.portrevolt.com/node/1593 - that is normally a URL for a 'node,' but in your environemnt that actually points to a view that has a pager. So I am just scratching my head trying to understand how it happens. But, do not worry, it's all about me trying to understand, I am not very familiar with all the ins and outs of views...
Comment #9
jnimchuk commentedExport of gallery_images view:
uuid: 27fb4fdb-78b5-4b2d-a429-41faacf46fe3
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_artist
- field.storage.node.field_image
- field.storage.node.field_provenance
- node.type.gallery_image
- taxonomy.vocabulary.gallery_albums
module:
- image
- node
- pagerer
- taxonomy
- user
id: gallery_images
label: gallery_images
module: views
description: 'Gallery Images (with filtering by album)'
tag: ''
base_table: node_field_data
base_field: nid
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'access content'
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: pagerer
options:
preset: pagerer_slider
items_per_page: 3
offset: 0
id: '0'
total_pages: ''
expose:
items_per_page: 0
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: 0
items_per_page_options_all_label: '- All -'
offset: 0
offset_label: Offset
style:
type: grid
options:
grouping: { }
columns: 3
automatic_width: true
alignment: horizontal
col_class_default: true
col_class_custom: ''
row_class_default: true
row_class_custom: ''
row:
type: fields
options:
default_field_elements: true
inline:
field_provenance: field_provenance
field_artist: field_artist
separator: ' '
hide_empty: false
fields:
field_image:
id: field_image
table: node__field_image
field: field_image
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: image
settings:
image_style: gallery_thumbnail
image_link: content
group_column: ''
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
plugin_id: field
title:
id: title
table: node_field_data
field: title
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: true
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: node
entity_field: title
plugin_id: field
field_provenance:
id: field_provenance
table: node__field_provenance
field: field_provenance
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
plugin_id: field
field_artist:
id: field_artist
table: node__field_artist
field: field_artist
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: false
group_column: target_id
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
plugin_id: field
filters:
status:
value: true
table: node_field_data
field: status
plugin_id: boolean
entity_type: node
entity_field: status
id: status
expose:
operator: ''
group: 1
type:
id: type
table: node_field_data
field: type
value:
gallery_image: gallery_image
entity_type: node
entity_field: type
plugin_id: bundle
sorts:
field_album_name_target_id:
id: field_album_name_target_id
table: node__field_album_name
field: field_album_name_target_id
relationship: none
group_type: group
admin_label: ''
order: ASC
exposed: false
expose:
label: ''
plugin_id: standard
title:
id: title
table: node_field_data
field: title
relationship: none
group_type: group
admin_label: ''
order: ASC
exposed: false
expose:
label: ''
entity_type: node
entity_field: title
plugin_id: standard
header: { }
footer: { }
empty: { }
relationships: { }
arguments:
tid:
id: tid
table: taxonomy_index
field: tid
relationship: none
group_type: group
admin_label: ''
default_action: ignore
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: fixed
default_argument_options:
argument: ''
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: true
validate:
type: 'entity:taxonomy_term'
fail: 'not found'
validate_options:
bundles:
gallery_albums: gallery_albums
operation: view
multiple: 0
access: false
break_phrase: false
add_table: false
require_value: false
reduce_duplicates: false
plugin_id: taxonomy_index_tid
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
- user.permissions
tags:
- 'config:field.storage.node.field_artist'
- 'config:field.storage.node.field_image'
- 'config:field.storage.node.field_provenance'
embed_1:
display_plugin: embed
id: embed_1
display_title: Embed
position: 2
display_options:
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
- user.permissions
tags:
- 'config:field.storage.node.field_artist'
- 'config:field.storage.node.field_image'
- 'config:field.storage.node.field_provenance'
Comment #10
mondrakeAh ok, so a "gallery" is a content type, Rembrandt Peale is a node of gallery type, and somehow the view is linked to that node. Is that (more or less) right? That would explain the node URL.
Thanks!
Comment #11
jnimchuk commentedCorrect!
Comment #12
mondrakeI'm pretty confident that patch in #2687453: drupalSettings.path.currentPath refers to the route's URL even when page is accessed through an URL alias for Drupal core would solve this without needing changes to Pagerer.
@jnimchuk is there a chance you can test that and feedback?
Let's come back here once core's fix is in to confirm (or not) that Pagerer is fixed too.
Comment #13
jnimchuk commentedI was able to make changes to PathAliasTest.php.
However, my system.module file does not contain any of these lines, so unable to make changes there.
=================
@@ -690,7 +690,10 @@ function system_js_settings_alter(&$settings, AttachedAssetsInterface $assets) {
if ($route_match instanceof StackedRouteMatchInterface) {
$route_match = $route_match->getMasterRouteMatch();
}
=================
What am I doing wrong?
Comment #14
mondrakemost likely you're on a 8.0.x version. the patch is for 8.2.x dev, sorry
Comment #15
jnimchuk commentedYeah, I don't have that installed. Not going to either ...
Sorry.
Comment #16
mondrakeThe core's issue stalled, so let's fix this in Pagerer, following suggestion in #2687453-25: drupalSettings.path.currentPath refers to the route's URL even when page is accessed through an URL alias.
@jnimchuk would you have a chance to test this one?
Comment #18
mondrakeOk, tested with language prefixes too and it works well. Committed.
Comment #19
jnimchuk commentedVery good, Mondrake. It works; thanks.
You can check the result here: http://test8.portrevolt.com/images/gallery/photos_of_places/ma
I have an additional request. I understand that as a developer, first item is 0, then next is 1. However, to a user it's confusing going to page 2 and seeing: url?page=1.
Is there a way to make this configurable? Say an offset for those that want it where the first page is "?page=1" instead of "?page=0".
Fix this and your module will be perfect!
Thanks again,
John
Comment #20
mondrakeThanks John.
:) feel free to join the party over at #1818040: Pager should start counting from 1, not 0...
In short - we cannot do anything at the moment, the pager is one part of Drupal which is non-overrideable. We may be able to do something in a contrib module like this one, but core should at least do #2044435: Convert pager.inc to a service before we can think of it.