Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-5625 News liftup languages #103

Merged
merged 13 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
"patches": {
"drupal/core": {
"[#2706241] AccessAwareRouter does not respect HTTP method": "https://www.drupal.org/files/issues/2022-02-01/2706241-67.patch"
},
"drupal/draggableviews": {
"Save langcode as part of draggableviews data in order to sort by by weight and language": "patches/draggableviews_language.patch"
}
},
"composer-exit-on-patch-failure": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ settings:
provider: views
context_mapping: { }
views_label: ''
items_per_page: none
items_per_page: '5'
visibility:
'entity_bundle:node':
id: 'entity_bundle:node'
Expand Down
18 changes: 18 additions & 0 deletions conf/cmi/language/fi/views.view.ordered_news_list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
label: Uutislista
description: 'Järjestä etusivulle nostetut uutiset '
display:
default:
display_options:
header:
area:
content:
value: "<p>Järjestä etusivun pääuutis-lohkoon nostetut uutiset haluamaasi järjestykseen</p>\r\n"
format: full_html
title: 'Järjestele etusivulle nostetut uutiset'
empty:
area_text_custom:
content: 'Yhtään etusivun uutisvirtaan nostettua uutista ei löytynyt. Voit muokata olemassaolevaa uutista tai luoda uuden uutisen haluamallasi kielellä ja nosta oikean kieliversion uutisvirtaan käyttääksesi tätä ominaisuutta.'
ordered_news:
display_title: 'Järjestelty uutislista'
display_options:
display_description: 'Järjestä etusivulle nostetut uutiset'
201 changes: 182 additions & 19 deletions conf/cmi/views.view.ordered_news_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ display:
display_plugin: default
position: 0
display_options:
title: 'Sort main news'
title: 'Sort frontpage main news'
fields:
title:
id: title
Expand All @@ -34,16 +34,34 @@ display:
entity_type: node
entity_field: title
plugin_id: field
label: ''
label: Title
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
word_boundary: false
ellipsis: 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: ''
Expand All @@ -60,7 +78,7 @@ display:
click_sort_column: value
type: string
settings:
link_to_entity: true
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
Expand Down Expand Up @@ -131,6 +149,72 @@ display:
text: edit
output_url_as_text: false
absolute: false
langcode:
id: langcode
table: node_field_data
field: langcode
relationship: none
group_type: group
admin_label: ''
entity_type: node
entity_field: langcode
plugin_id: field
label: 'Translation language'
exclude: true
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: true
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: language
settings:
link_to_entity: false
native_language: 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
pager:
type: mini
options:
Expand Down Expand Up @@ -166,24 +250,26 @@ display:
cache:
type: tag
options: { }
empty: { }
empty:
area_text_custom:
id: area_text_custom
table: views
field: area_text_custom
relationship: none
group_type: group
admin_label: ''
plugin_id: text_custom
empty: true
content: 'There are currently no news set to be shown on front pages news feed for this language'
tokenize: false
sorts:
weight:
id: weight
table: draggableviews_structure
field: weight
relationship: none
group_type: group
admin_label: ''
plugin_id: draggable_views_sort_default
order: ASC
expose:
label: ''
field_identifier: ''
exposed: false
draggable_views_reference: this
draggable_views_null_order: after
draggable_views_pass_arguments: false
field_identifier: weight
arguments: { }
filters:
status:
Expand All @@ -208,6 +294,7 @@ display:
plugin_id: bundle
value:
news_item: news_item
group: 1
expose:
operator_limit_selection: false
operator_list: { }
Expand Down Expand Up @@ -293,23 +380,65 @@ display:
default_group: All
default_group_multiple: { }
group_items: { }
filter_groups:
operator: AND
groups:
1: AND
style:
type: table
options:
grouping: { }
row_class: ''
default_row_class: true
columns:
nid: nid
title: title
draggableviews: draggableviews
edit_node: edit_node
weight: weight
langcode: langcode
default: '-1'
info:
nid:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
title:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
draggableviews:
align: ''
separator: ''
empty_column: false
responsive: ''
edit_node:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
weight:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
langcode:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
override: true
sticky: false
summary: ''
Expand All @@ -328,11 +457,24 @@ display:
options:
query_comment: ''
disable_sql_rewrite: false
distinct: false
distinct: true
replica: false
query_tags: { }
relationships: { }
header: { }
header:
area:
id: area
table: views
field: area
relationship: none
group_type: group
admin_label: ''
plugin_id: text
empty: false
content:
value: 'Sort news items lifted to front page news block in preferred order.'
format: full_html
tokenize: false
footer: { }
display_extenders: { }
cache_metadata:
Expand All @@ -350,13 +492,34 @@ display:
display_plugin: page
position: 1
display_options:
sorts:
weight:
id: weight
table: draggableviews_structure
field: weight
relationship: none
group_type: group
admin_label: ''
plugin_id: draggable_views_sort_default
order: ASC
expose:
label: ''
field_identifier: ''
exposed: false
draggable_views_reference: this
draggable_views_null_order: after
draggable_views_pass_arguments: false
defaults:
group_by: false
sorts: false
group_by: false
display_description: 'Order front page main news'
rendering_language: '***LANGUAGE_language_content***'
display_extenders: { }
path: admin/ordered-news
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- 'user.node_grants:view'
Expand Down
28 changes: 28 additions & 0 deletions patches/draggableviews_language.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/draggableviews.module b/draggableviews.module
index eaba8c8..80d1491 100644
--- a/draggableviews.module
+++ b/draggableviews.module
@@ -174,6 +174,7 @@ function draggableviews_views_submit(&$form, FormStateInterface $form_state) {

$connection = Database::getConnection();
$transaction = $connection->startTransaction();
+ $langcode = \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\LanguageInterface::TYPE_CONTENT)->getId();
try {
foreach ($input['draggableviews'] as $item) {
// Remove old data.
@@ -182,6 +183,7 @@ function draggableviews_views_submit(&$form, FormStateInterface $form_state) {
->condition('view_display', $view_display)
->condition('args', $view_args)
->condition('entity_id', $item['id'])
+ ->condition('langcode', $langcode)
->execute();

// Add new data.
@@ -191,6 +193,7 @@ function draggableviews_views_submit(&$form, FormStateInterface $form_state) {
'args' => $view_args,
'entity_id' => $item['id'],
'weight' => $item['weight'],
+ 'langcode' => $langcode,
];
// Save parent if exists.
if (isset($item['parent'])) {
1 change: 1 addition & 0 deletions public/modules/custom/helfi_etusivu/helfi_etusivu.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ package: Custom
core_version_requirement: ^9 || ^10
dependencies:
- rest
- draggableviews
'interface translation project': helfi_etusivu
'interface translation server pattern': modules/custom/helfi_etusivu/translations/%language.po
Loading