présentation anchors

This commit is contained in:
Bachir Soussi Chiadmi 2024-03-06 11:40:55 +01:00
parent c568be7711
commit ad78e05fa9
3 changed files with 158 additions and 15 deletions

View File

@ -8,7 +8,7 @@ dependencies:
module: module:
- paragraphs - paragraphs
id: statics id: statics
label: Statics label: 'Statics Parts (paragraphs)'
module: views module: views
description: '' description: ''
tag: '' tag: ''
@ -23,6 +23,134 @@ display:
display_options: display_options:
title: 'Statics Parts' title: 'Statics Parts'
fields: fields:
id:
id: id
table: paragraphs_item_field_data
field: id
relationship: none
group_type: group
admin_label: ''
entity_type: paragraph
entity_field: id
plugin_id: field
label: ''
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: 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: number_unformatted
settings: { }
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
parent_id:
id: parent_id
table: paragraphs_item_field_data
field: parent_id
relationship: none
group_type: group
admin_label: ''
entity_type: paragraph
entity_field: parent_id
plugin_id: field
label: ''
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: 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: { }
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
field_title: field_title:
id: field_title id: field_title
table: paragraph__field_title table: paragraph__field_title
@ -36,8 +164,8 @@ display:
alter: alter:
alter_text: false alter_text: false
text: '' text: ''
make_link: false make_link: true
path: '' path: '/node/{{parent_id}}#paragraph-id--{{ id }}'
absolute: false absolute: false
external: false external: false
replace_spaces: false replace_spaces: false
@ -234,7 +362,18 @@ display:
distinct: false distinct: false
replica: false replica: false
query_tags: { } query_tags: { }
relationships: { } relationships:
id:
id: id
table: paragraphs_item_revision_field_data
field: id
relationship: none
group_type: group
admin_label: id
entity_type: paragraph
entity_field: id
plugin_id: standard
required: true
header: { } header: { }
footer: { } footer: { }
display_extenders: { } display_extenders: { }

View File

@ -85,3 +85,16 @@ function quartiers_de_demain_preprocess_field(&$variables) {
function quartiers_de_demain_preprocess_block(&$variables) { function quartiers_de_demain_preprocess_block(&$variables) {
} }
// function quartiers_de_demain_preprocess_views_view_field(&$variables){
// /** @var Drupal\views\Entity\View */
// $view = $variables['view'];
// $viewid = $view->id();
// if ($viewid === "statics") {
// /** @var Drupal\views\ResultRow */
// $row = $variables['row'];
// /** @var Drupal\views\Plugin\views\field\EntityField */
// $field = $variables['field'];
// }
// }

View File

@ -48,18 +48,9 @@
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{%- if field.element_type -%} {%- if field.element_type -%}
<{{ field.element_type }}{{ field.element_attributes }}> <{{ field.element_type }}{{ field.element_attributes }}>
{# Vérifiez d'abord si le champ contient des données #}
{% if row._entity.static_parts is not empty %}
{# Accédez à l'ID du paragraphe #}
{% set paragraph_id = row._entity.static_parts.entity.id() %}
{% endif %}
{# Créez le lien d'ancrage avec l'ID du paragraphe #}
<a href="#{{ paragraph_id }}">{{ field.content }}</a>
</{{ field.element_type }}>
{%- else -%}
{{ field.content }} {{ field.content }}
</{{ field.element_type }}>
{%- endif %} {%- endif %}
{%- if field.wrapper_element -%} {%- if field.wrapper_element -%}
</{{ field.wrapper_element }}> </{{ field.wrapper_element }}>