sort articles by field_date

This commit is contained in:
Bachir Soussi Chiadmi 2021-08-06 00:10:43 +02:00
parent cf3fc3eb31
commit 1ea234644e
4 changed files with 105 additions and 2 deletions

View File

@ -10,7 +10,7 @@ field_name: field_date
entity_type: node
type: daterange
settings:
datetime_type: datetime
datetime_type: allday
module: datetime_range
locked: false
cardinality: 1

View File

@ -4,6 +4,7 @@ status: true
dependencies:
config:
- field.storage.node.field_attachments
- field.storage.node.field_date
- field.storage.node.field_distributor
- field.storage.node.field_index
- field.storage.node.field_linked_articles
@ -33,6 +34,7 @@ dependencies:
- better_exposed_filters
- computed_field
- content_lock
- date_range_formatter
- file
- image
- materio_samples
@ -5138,7 +5140,7 @@ display:
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
multi_type: ul
separator: ', '
field_api_classes: false
plugin_id: field
@ -5268,6 +5270,75 @@ display:
separator: ', '
field_api_classes: false
plugin_id: field
field_date:
id: field_date
table: node__field_date
field: field_date
relationship: none
group_type: group
admin_label: ''
label: Date
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: 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: date_range_without_time
settings:
timezone_override: ''
single: 'd F Y'
single_all_day: 'd F Y'
one_day: 'd F Y'
one_month: 'd - {d} F Y'
several_months: 'd F - {d} {F} Y'
several_years: 'd F Y - {d} {F} {Y}'
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_workflow:
id: field_workflow
table: node__field_workflow
@ -5877,11 +5948,13 @@ display:
field_thesaurus: field_thesaurus
field_tags: field_tags
field_linked_materials: field_linked_materials
field_showroom: field_showroom
field_workflow: field_workflow
field_migration: field_migration
created: created
changed: changed
field_memo: field_memo
field_date: field_date
info:
views_bulk_operations_bulk_form:
align: ''
@ -5927,6 +6000,13 @@ display:
separator: ''
empty_column: false
responsive: ''
field_showroom:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
field_workflow:
sortable: false
default_sort_order: asc
@ -5962,6 +6042,13 @@ display:
separator: ''
empty_column: false
responsive: ''
field_date:
sortable: true
default_sort_order: desc
align: ''
separator: ''
empty_column: false
responsive: ''
default: '-1'
empty_table: false
row:
@ -5977,6 +6064,7 @@ display:
- 'user.node_grants:view'
- user.roles
tags:
- 'config:field.storage.node.field_date'
- 'config:field.storage.node.field_linked_materials'
- 'config:field.storage.node.field_memo'
- 'config:field.storage.node.field_migration'

View File

@ -11,6 +11,7 @@ dependencies:
- node.type.article
- system.menu.header
module:
- datetime
- datetime_range
- image
- node
@ -759,6 +760,19 @@ display:
reduce_duplicates: false
plugin_id: workflow_state
sorts:
field_date_value:
id: field_date_value
table: node__field_date
field: field_date_value
relationship: none
group_type: group
admin_label: ''
order: DESC
exposed: false
expose:
label: ''
granularity: day
plugin_id: datetime
created:
id: created
table: node_field_data

View File

@ -37,6 +37,7 @@ class ComputedArticlesReferences extends EntityReferenceFieldItemList
protected function computeValue() {
$query = \Drupal::entityQuery('node')
->condition('status', 1)
->sort('field_date', 'DESC')
->sort('created', 'DESC')
->exists('field_visuel')
->range(0,12)