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/amswap": "^3.1",
"drupal/audiofield": "1.x-dev@dev",
"drupal/base_field_override_ui": "^1.1",
"drupal/core-composer-scaffold": "^9.4",
"drupal/core-project-message": "^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",
"This file is @generated automatically"
],
"content-hash": "4c0284e2283429a9a3564df19923e993",
"content-hash": "0dc54aabca9896a49a4cb27bfda2b2c9",
"packages": [
{
"name": "alchemy/zippy",
@ -2839,6 +2839,54 @@
"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",
"version": "5.2.0",

View File

@ -9,7 +9,7 @@ field_name: title
entity_type: node
bundle: concernement
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
translatable: true
default_value: { }

View File

@ -9,8 +9,10 @@ dependencies:
- field.field.node.concernement.field_recit
- node.type.concernement
module:
- advanced_text_formatter
- field_group
- file
- maxlength
- paragraphs
third_party_settings:
field_group:
@ -18,6 +20,7 @@ third_party_settings:
children:
- group_contenu
- group_entites
- group_recit
- status
- uid
- created
@ -35,10 +38,9 @@ third_party_settings:
group_contenu:
children:
- title
- field_caillou
- field_description
- field_recit
label: Contenu
- field_caillou
label: Concernement
region: content
parent_name: group_tabs
weight: 12
@ -65,6 +67,21 @@ third_party_settings:
formatter: closed
description: ''
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
targetEntityType: node
bundle: concernement
@ -78,7 +95,7 @@ content:
third_party_settings: { }
field_caillou:
type: string_textarea
weight: 1
weight: 2
region: content
settings:
rows: 5
@ -86,7 +103,7 @@ content:
third_party_settings: { }
field_description:
type: string_textarea
weight: 2
weight: 1
region: content
settings:
rows: 5
@ -123,9 +140,14 @@ content:
weight: 0
region: content
settings:
size: 60
size: 80
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:
type: entity_reference_autocomplete
weight: 16

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@ langcode: fr
status: true
dependencies:
config:
- field.field.paragraph.entite_concernement.field_active
- field.field.paragraph.entite_concernement.field_actuel_future
- field.field.paragraph.entite_concernement.field_entite
- field.field.paragraph.entite_concernement.field_menace_maintien_degres
@ -15,6 +16,16 @@ targetEntityType: paragraph
bundle: entite_concernement
mode: default
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:
type: list_default
label: above

View File

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

View File

@ -1,4 +1,16 @@
_core:
default_config_hash: jdY7AU0tU-QsjmiOw3W8vwpYMb-By--_MSFgbqKUTYM
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
bundle: concernement
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
translatable: false
default_value: { }

View File

@ -10,7 +10,7 @@ field_name: field_description
entity_type: node
bundle: concernement
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
translatable: false
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
entity_type: paragraph
bundle: source
label: Description
label: 'Experience vécue'
description: ''
required: 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
dependencies: { }
id: entite_concernement
label: 'Entité intégrée'
label: Entité
icon_uuid: null
icon_default: null
description: 'Paragraphe qui pointe un CT entité et y ajoute les infos propre au concernement'

View File

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

View File

@ -188,6 +188,29 @@
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{
display: flex;
flex-direction: row;

View File

@ -5,10 +5,13 @@
* Functions to support theming in the Seven theme.
*/
use Drupal\breakpoint\Breakpoint;
use Drupal\Core\Form\FormStateInterface;
use \Drupal\Core\Url;
use Drupal\Core\Render\Markup;
use function Psy\debug;
/**
* Implements hook_preprocess_HOOK() for HTML document templates.
*/
@ -115,11 +118,46 @@ function ouatminimal_preprocess_toolbar(&$variables) {
}
function ouatminimal_preprocess_form_element(&$variables) {
$element = $variables['element'];
if(isset($variables['description_display'])){
$variables['description_display']="before";
}
}
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 }}