concernement form concernement improved

This commit is contained in:
Bachir Soussi Chiadmi 2023-03-17 14:04:20 +01:00
parent 2b23013fa5
commit b9a20da330
20 changed files with 277 additions and 43 deletions

View File

@ -20,6 +20,7 @@
"drupal/administerusersbyrole": "^3.3", "drupal/administerusersbyrole": "^3.3",
"drupal/amswap": "^3.1", "drupal/amswap": "^3.1",
"drupal/audiofield": "1.x-dev@dev", "drupal/audiofield": "1.x-dev@dev",
"drupal/base_field_override_ui": "^1.1",
"drupal/core-composer-scaffold": "^9.4", "drupal/core-composer-scaffold": "^9.4",
"drupal/core-project-message": "^9.4", "drupal/core-project-message": "^9.4",
"drupal/core-recommended": "^9.4", "drupal/core-recommended": "^9.4",

50
src/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "4c0284e2283429a9a3564df19923e993", "content-hash": "0dc54aabca9896a49a4cb27bfda2b2c9",
"packages": [ "packages": [
{ {
"name": "alchemy/zippy", "name": "alchemy/zippy",
@ -2839,6 +2839,54 @@
"source": "https://git.drupalcode.org/project/autologout" "source": "https://git.drupalcode.org/project/autologout"
} }
}, },
{
"name": "drupal/base_field_override_ui",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/base_field_override_ui.git",
"reference": "8.x-1.1"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/base_field_override_ui-8.x-1.1.zip",
"reference": "8.x-1.1",
"shasum": "28c7f67ace8a285deb84c373df4589df13b823fb"
},
"require": {
"drupal/core": "^8.8 || ^9 || ^10"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-1.1",
"datestamp": "1671410225",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
}
}
},
"notification-url": "https://packages.drupal.org/8/downloads",
"license": [
"GPL-2.0+"
],
"authors": [
{
"name": "mnico",
"homepage": "https://www.drupal.org/user/1119544"
}
],
"description": "Enables the possibility to easily override the base fields of any content entity type with an user interface",
"homepage": "https://www.drupal.org/project/base_field_override_ui",
"keywords": [
"Drupal"
],
"support": {
"source": "https://git.drupalcode.org/project/base_field_override_ui",
"issues": "https://www.drupal.org/project/issues/base_field_override_ui"
}
},
{ {
"name": "drupal/better_exposed_filters", "name": "drupal/better_exposed_filters",
"version": "5.2.0", "version": "5.2.0",

View File

@ -9,7 +9,7 @@ field_name: title
entity_type: node entity_type: node
bundle: concernement bundle: concernement
label: Nom label: Nom
description: '' description: 'Quel est l''être / l''élément / l''entité / l''activité indispensable à votre existence dont vous avez appris que son maintien était menacé ?'
required: true required: true
translatable: true translatable: true
default_value: { } default_value: { }

View File

@ -9,8 +9,10 @@ dependencies:
- field.field.node.concernement.field_recit - field.field.node.concernement.field_recit
- node.type.concernement - node.type.concernement
module: module:
- advanced_text_formatter
- field_group - field_group
- file - file
- maxlength
- paragraphs - paragraphs
third_party_settings: third_party_settings:
field_group: field_group:
@ -18,6 +20,7 @@ third_party_settings:
children: children:
- group_contenu - group_contenu
- group_entites - group_entites
- group_recit
- status - status
- uid - uid
- created - created
@ -35,10 +38,9 @@ third_party_settings:
group_contenu: group_contenu:
children: children:
- title - title
- field_caillou
- field_description - field_description
- field_recit - field_caillou
label: Contenu label: Concernement
region: content region: content
parent_name: group_tabs parent_name: group_tabs
weight: 12 weight: 12
@ -65,6 +67,21 @@ third_party_settings:
formatter: closed formatter: closed
description: '' description: ''
required_fields: true required_fields: true
group_recit:
children:
- field_recit
label: Récit
region: content
parent_name: group_tabs
weight: 14
format_type: tab
format_settings:
classes: ''
show_empty_fields: false
id: ''
formatter: closed
description: ''
required_fields: true
id: node.concernement.default id: node.concernement.default
targetEntityType: node targetEntityType: node
bundle: concernement bundle: concernement
@ -78,7 +95,7 @@ content:
third_party_settings: { } third_party_settings: { }
field_caillou: field_caillou:
type: string_textarea type: string_textarea
weight: 1 weight: 2
region: content region: content
settings: settings:
rows: 5 rows: 5
@ -86,7 +103,7 @@ content:
third_party_settings: { } third_party_settings: { }
field_description: field_description:
type: string_textarea type: string_textarea
weight: 2 weight: 1
region: content region: content
settings: settings:
rows: 5 rows: 5
@ -123,9 +140,14 @@ content:
weight: 0 weight: 0
region: content region: content
settings: settings:
size: 60 size: 80
placeholder: '' placeholder: ''
third_party_settings: { } third_party_settings:
maxlength:
maxlength_js: null
maxlength_js_label: 'Contenu limité à @limit caractères, restant : <strong>@remaining</strong>'
advanced_text_formatter:
show_token_tree: 0
uid: uid:
type: entity_reference_autocomplete type: entity_reference_autocomplete
weight: 16 weight: 16

View File

@ -101,8 +101,8 @@ content:
weight: 0 weight: 0
region: content region: content
settings: settings:
size: 60 size: 80
placeholder: '' placeholder: 'Pouvez-vous nommer par qui ou par quoi "CONCERNEMENT" est menacé ou maintenu ? '
third_party_settings: third_party_settings:
maxlength: maxlength:
maxlength_js: null maxlength_js: null

View File

@ -3,6 +3,7 @@ langcode: fr
status: true status: true
dependencies: dependencies:
config: config:
- field.field.paragraph.entite_concernement.field_active
- field.field.paragraph.entite_concernement.field_actuel_future - field.field.paragraph.entite_concernement.field_actuel_future
- field.field.paragraph.entite_concernement.field_entite - field.field.paragraph.entite_concernement.field_entite
- field.field.paragraph.entite_concernement.field_menace_maintien_degres - field.field.paragraph.entite_concernement.field_menace_maintien_degres
@ -15,15 +16,22 @@ targetEntityType: paragraph
bundle: entite_concernement bundle: entite_concernement
mode: default mode: default
content: content:
field_active:
type: boolean_checkbox
weight: 0
region: content
settings:
display_label: true
third_party_settings: { }
field_actuel_future: field_actuel_future:
type: options_buttons type: options_buttons
weight: 0 weight: 1
region: content region: content
settings: { } settings: { }
third_party_settings: { } third_party_settings: { }
field_entite: field_entite:
type: inline_entity_form_complex type: inline_entity_form_complex
weight: 3 weight: 4
region: content region: content
settings: settings:
form_mode: default form_mode: default
@ -40,14 +48,14 @@ content:
third_party_settings: { } third_party_settings: { }
field_menace_maintien_degres: field_menace_maintien_degres:
type: number type: number
weight: 1 weight: 2
region: content region: content
settings: settings:
placeholder: '' placeholder: ''
third_party_settings: { } third_party_settings: { }
field_prise: field_prise:
type: number type: number
weight: 2 weight: 3
region: content region: content
settings: settings:
placeholder: '' placeholder: ''

View File

@ -25,7 +25,6 @@ third_party_settings:
field_group: field_group:
group_tabs: group_tabs:
children: children:
- group_texte
- group_media - group_media
- group_videos - group_videos
- group_audio - group_audio
@ -34,7 +33,7 @@ third_party_settings:
label: Tabs label: Tabs
region: content region: content
parent_name: '' parent_name: ''
weight: 0 weight: 2
format_type: tabs format_type: tabs
format_settings: format_settings:
classes: '' classes: ''
@ -43,13 +42,11 @@ third_party_settings:
direction: horizontal direction: horizontal
width_breakpoint: 640 width_breakpoint: 640
group_texte: group_texte:
children: children: { }
- field_date label: 'Experience vécue'
- field_description region: hidden
label: Texte parent_name: ''
region: content weight: 3
parent_name: group_tabs
weight: 20
format_type: tab format_type: tab
format_settings: format_settings:
classes: '' classes: ''
@ -64,7 +61,7 @@ third_party_settings:
label: Images label: Images
region: content region: content
parent_name: group_tabs parent_name: group_tabs
weight: 21 weight: 31
format_type: tab format_type: tab
format_settings: format_settings:
classes: '' classes: ''
@ -79,7 +76,7 @@ third_party_settings:
label: Liens label: Liens
region: content region: content
parent_name: group_tabs parent_name: group_tabs
weight: 25 weight: 35
format_type: tab format_type: tab
format_settings: format_settings:
classes: '' classes: ''
@ -93,7 +90,7 @@ third_party_settings:
label: Details label: Details
region: hidden region: hidden
parent_name: '' parent_name: ''
weight: 1 weight: 6
format_type: details format_type: details
format_settings: format_settings:
classes: '' classes: ''
@ -108,7 +105,7 @@ third_party_settings:
label: Documents label: Documents
region: content region: content
parent_name: group_tabs parent_name: group_tabs
weight: 24 weight: 34
format_type: tab format_type: tab
format_settings: format_settings:
classes: '' classes: ''
@ -123,7 +120,7 @@ third_party_settings:
label: Videos label: Videos
region: content region: content
parent_name: group_tabs parent_name: group_tabs
weight: 22 weight: 32
format_type: tab format_type: tab
format_settings: format_settings:
classes: '' classes: ''
@ -138,7 +135,7 @@ third_party_settings:
label: Audio label: Audio
region: content region: content
parent_name: group_tabs parent_name: group_tabs
weight: 23 weight: 33
format_type: tab format_type: tab
format_settings: format_settings:
classes: '' classes: ''
@ -161,13 +158,13 @@ content:
third_party_settings: { } third_party_settings: { }
field_date: field_date:
type: datetime_default type: datetime_default
weight: 29 weight: 0
region: content region: content
settings: { } settings: { }
third_party_settings: { } third_party_settings: { }
field_description: field_description:
type: string_textarea type: string_textarea
weight: 30 weight: 1
region: content region: content
settings: settings:
rows: 8 rows: 8

View File

@ -3,6 +3,7 @@ langcode: fr
status: true status: true
dependencies: dependencies:
config: config:
- field.field.paragraph.entite_concernement.field_active
- field.field.paragraph.entite_concernement.field_actuel_future - field.field.paragraph.entite_concernement.field_actuel_future
- field.field.paragraph.entite_concernement.field_entite - field.field.paragraph.entite_concernement.field_entite
- field.field.paragraph.entite_concernement.field_menace_maintien_degres - field.field.paragraph.entite_concernement.field_menace_maintien_degres
@ -15,6 +16,16 @@ targetEntityType: paragraph
bundle: entite_concernement bundle: entite_concernement
mode: default mode: default
content: content:
field_active:
type: boolean
label: above
settings:
format: default
format_custom_false: ''
format_custom_true: ''
third_party_settings: { }
weight: 6
region: content
field_actuel_future: field_actuel_future:
type: list_default type: list_default
label: above label: above

View File

@ -14,6 +14,7 @@ module:
audiofield: 0 audiofield: 0
autocomplete_deluxe: 0 autocomplete_deluxe: 0
ban: 0 ban: 0
base_field_override_ui: 0
better_exposed_filters: 0 better_exposed_filters: 0
betterlogin: 0 betterlogin: 0
block: 0 block: 0

View File

@ -1,4 +1,16 @@
_core: _core:
default_config_hash: jdY7AU0tU-QsjmiOw3W8vwpYMb-By--_MSFgbqKUTYM default_config_hash: jdY7AU0tU-QsjmiOw3W8vwpYMb-By--_MSFgbqKUTYM
langcode: fr langcode: fr
definitions: { } definitions:
admin_menus__entitees:
enabled: false
menu_name: administrator
parent: admin_menus.contents
expanded: false
weight: 2
admin_menus__concernements:
enabled: false
menu_name: administrator
parent: admin_menus.contents
expanded: false
weight: 0

View File

@ -10,7 +10,7 @@ field_name: field_caillou
entity_type: node entity_type: node
bundle: concernement bundle: concernement
label: Caillou label: Caillou
description: '' description: 'Pouvez-vous décrire votre caillou dans votre chaussure, et en quoi il vous fait mal au pied quand vous marchez ?'
required: false required: false
translatable: false translatable: false
default_value: { } default_value: { }

View File

@ -10,7 +10,7 @@ field_name: field_description
entity_type: node entity_type: node
bundle: concernement bundle: concernement
label: Description label: Description
description: '' description: 'Pouvez-vous décrire précisément en quelques lignes en quoi la présence de cet élément vous est indispensable ?'
required: false required: false
translatable: false translatable: false
default_value: { } default_value: { }

View File

@ -0,0 +1,23 @@
uuid: c96c90fd-bae7-432a-b3f4-2f5af2961f6a
langcode: fr
status: true
dependencies:
config:
- field.storage.paragraph.field_active
- paragraphs.paragraphs_type.entite_concernement
id: paragraph.entite_concernement.field_active
field_name: field_active
entity_type: paragraph
bundle: entite_concernement
label: Active
description: ''
required: false
translatable: false
default_value:
-
value: 1
default_value_callback: ''
settings:
on_label: Activé
off_label: Désactivé
field_type: boolean

View File

@ -9,7 +9,7 @@ id: paragraph.source.field_description
field_name: field_description field_name: field_description
entity_type: paragraph entity_type: paragraph
bundle: source bundle: source
label: Description label: 'Experience vécue'
description: '' description: ''
required: false required: false
translatable: false translatable: false

View File

@ -0,0 +1,18 @@
uuid: 5f8e42de-33cb-4ee3-a280-d514875437d0
langcode: fr
status: true
dependencies:
module:
- paragraphs
id: paragraph.field_active
field_name: field_active
entity_type: paragraph
type: boolean
settings: { }
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@ -3,7 +3,7 @@ langcode: fr
status: true status: true
dependencies: { } dependencies: { }
id: entite_concernement id: entite_concernement
label: 'Entité intégrée' label: Entité
icon_uuid: null icon_uuid: null
icon_default: null icon_default: null
description: 'Paragraphe qui pointe un CT entité et y ajoute les infos propre au concernement' description: 'Paragraphe qui pointe un CT entité et y ajoute les infos propre au concernement'

View File

@ -5,6 +5,8 @@ dependencies:
config: config:
- node.type.concernement - node.type.concernement
- node.type.entite - node.type.entite
- user.role.admin
- user.role.root
module: module:
- content_lock - content_lock
- node - node
@ -120,9 +122,11 @@ display:
sort_asc_label: Asc sort_asc_label: Asc
sort_desc_label: Desc sort_desc_label: Desc
access: access:
type: perm type: role
options: options:
perm: 'access content' role:
admin: admin
root: root
cache: cache:
type: tag type: tag
options: { } options: { }
@ -288,7 +292,7 @@ display:
- url - url
- url.query_args - url.query_args
- 'user.node_grants:view' - 'user.node_grants:view'
- user.permissions - user.roles
tags: { } tags: { }
page_1: page_1:
id: page_1 id: page_1
@ -738,6 +742,12 @@ display:
multi_type: separator multi_type: separator
separator: ', ' separator: ', '
field_api_classes: false field_api_classes: false
access:
type: role
options:
role:
admin: admin
root: root
filters: filters:
status: status:
id: status id: status
@ -830,6 +840,7 @@ display:
groups: groups:
1: AND 1: AND
defaults: defaults:
access: false
fields: false fields: false
filters: false filters: false
filter_groups: false filter_groups: false
@ -859,7 +870,7 @@ display:
- url - url
- url.query_args - url.query_args
- 'user.node_grants:view' - 'user.node_grants:view'
- user.permissions - user.roles
tags: { } tags: { }
page_2: page_2:
id: page_2 id: page_2
@ -1310,6 +1321,11 @@ display:
multi_type: separator multi_type: separator
separator: ', ' separator: ', '
field_api_classes: false field_api_classes: false
access:
type: role
options:
role:
root: root
filters: filters:
status: status:
id: status id: status
@ -1482,6 +1498,7 @@ display:
separator: '' separator: ''
hide_empty: false hide_empty: false
defaults: defaults:
access: false
title: false title: false
style: false style: false
row: false row: false
@ -1514,5 +1531,5 @@ display:
- url - url
- url.query_args - url.query_args
- 'user.node_grants:view' - 'user.node_grants:view'
- user.permissions - user.roles
tags: { } tags: { }

View File

@ -188,6 +188,29 @@
margin-left: 200px; margin-left: 200px;
} }
#node-concernement-edit-form .field--name-title label,
#node-concernement-edit-form .field--name-field-description label,
#node-concernement-edit-form .field--name-field-caillou label,
#node-concernement-form .field--name-title label,
#node-concernement-form .field--name-field-description label,
#node-concernement-form .field--name-field-caillou label{
display: none;
}
#node-concernement-edit-form .field--name-title>.form-item>div,
#node-concernement-edit-form .field--name-field-description>.form-item>div,
#node-concernement-edit-form .field--name-field-caillou>.form-item>div,
#node-concernement-form .field--name-title>.form-item>div,
#node-concernement-form .field--name-field-description>.form-item>div,
#node-concernement-form .field--name-field-caillou>.form-item>div{
font-weight: 600;
}
#node-concernement-edit-form .ief-entity-operations input[type="submit"].ief-submit-remove{
display: none;
}
#boussole-layout{ #boussole-layout{
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -5,10 +5,13 @@
* Functions to support theming in the Seven theme. * Functions to support theming in the Seven theme.
*/ */
use Drupal\breakpoint\Breakpoint;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use \Drupal\Core\Url; use \Drupal\Core\Url;
use Drupal\Core\Render\Markup; use Drupal\Core\Render\Markup;
use function Psy\debug;
/** /**
* Implements hook_preprocess_HOOK() for HTML document templates. * Implements hook_preprocess_HOOK() for HTML document templates.
*/ */
@ -115,11 +118,46 @@ function ouatminimal_preprocess_toolbar(&$variables) {
} }
function ouatminimal_preprocess_form_element(&$variables) { function ouatminimal_preprocess_form_element(&$variables) {
$element = $variables['element'];
if(isset($variables['description_display'])){ if(isset($variables['description_display'])){
$variables['description_display']="before"; $variables['description_display']="before";
} }
} }
function ouatminimal_preprocess_node_edit_form__node_concernement(&$variables) { function ouatminimal_preprocess_node_edit_form__node_concernement(&$variables) {
$variables['form']['advanced']['#group'] = "group_admin"; // $variables['form']['advanced']['#group'] = "group_admin";
// $ph = $variables['form']['title']['widget'][0]['value']['#placeholder'];
// $variables['form']['title']['widget']['#description'] = $ph;
// $variables['form']['title']['widget'][0]['#description'] = $ph;
// $variables['form']['title']['widget'][0]['value']['#description'] = $ph;
// $variables['form']['title']['widget']['#title'] = $ph;
// $variables['form']['title']['widget'][0]['#title'] = $ph;
// $variables['form']['title']['widget'][0]['value']['#title'] = $ph;
// $variables['form']['title']['widget'][0]['value']['#placeholder'] = "";
}
function ouatminimal_preprocess_input(&$variables) {
$element = &$variables['element'];
if ($element['#type'] === "submit") {
// edit-field-entite-0-subform-field-entite-actions-ief-add
$name = $element['#name'];
// rename entité reference in paragraphe "add node" to "editer entité"
if (preg_match('/^ief-field_entite-\d+-subform-field_entite-form-add$/', $name)) {
$element['#value'] = $element['#attributes']['value'] = $variables['attributes']['value'] = "Editer l'entité";
}
// rename remove (paragraphe) to "supprimer"
if (preg_match('/field_entite_\d+_remove/', $name)) {
$element['#value'] = $element['#attributes']['value'] = $variables['attributes']['value'] = "Supprimer";
}
// hide remove node ref submit
if (preg_match('/^ief-field_entite-\d+-subform-field_entite-form-entity-remove-\d+$/', $name)) {
$element['#value'] = $element['#attributes']['value'] = $variables['attributes']['value'] = "test";
$variables['attributes']['class'][] = 'ief-submit-remove';
}
}
} }

View File

@ -0,0 +1,15 @@
{#
/**
* @file
* Default theme implementation for an 'input' #type form element.
*
* Available variables:
* - attributes: A list of HTML attributes for the input element.
* - children: Optional additional rendered elements.
*
* @see template_preprocess_input()
*
* @ingroup themeable
*/
#}
<input{{ attributes }} />{{ children }}