concernement form concernement improved

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

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 }}