concernement form concernement improved
This commit is contained in:
@@ -37,9 +37,16 @@ function ouatt_admin_form_node_concernement_edit_form_alter(&$form, $form_state,
|
||||
$concernement_title = $concernement_node->getTitle();
|
||||
$form_state->setTemporaryValue("concernement_title", $concernement_title);
|
||||
// menace/maintien
|
||||
|
||||
$field_entite_widget = $form['field_entite']['widget'];
|
||||
$i = 0;
|
||||
while (isset($field_entite_widget[$i]) && $item = $field_entite_widget[$i]) {
|
||||
$ief_id = $item['subform']['field_entite']['widget']['#ief_id'];
|
||||
$mm = $item['subform']['field_menace_maintien_degres']['widget'][0]['value']['#default_value'];
|
||||
$form_state->setTemporaryValue($ief_id . "_mm", $mm);
|
||||
$i++;
|
||||
}
|
||||
// actuel/future
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -52,11 +59,35 @@ function ouatt_admin_form_node_concernement_edit_form_alter(&$form, $form_state,
|
||||
* The form state of the parent form.
|
||||
*/
|
||||
function ouatt_admin_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
|
||||
$t="t";
|
||||
// concernement title
|
||||
$concernement_title = $form_state->getTemporaryValue("concernement_title");
|
||||
$entity_form['field_menace_maintien']['widget']['#description'] = FieldFilteredMarkup::create("Pouvez-vous décrire en quoi l'action menace/maintient \"$concernement_title\" ?");
|
||||
$entity_form['field_menace_maintien']['widget'][0]['#description'] = FieldFilteredMarkup::create("Pouvez-vous décrire en quoi l'action menace/maintient \"$concernement_title\" ?");
|
||||
$entity_form['field_menace_maintien']['widget'][0]['value']['#description'] = FieldFilteredMarkup::create("Pouvez-vous décrire en quoi l'action menace/maintient \"$concernement_title\" ?");
|
||||
|
||||
// menace maintient
|
||||
$ief_id = $entity_form['#ief_id'];
|
||||
$mm = $form_state->getTemporaryValue($ief_id . "_mm");
|
||||
|
||||
// field menace / maintient
|
||||
$mm_string = "menace / maintient";
|
||||
if ($mm > 0) {
|
||||
$mm_string = "maintient";
|
||||
} else if ($mm < 0) {
|
||||
$mm_string = "menace";
|
||||
}
|
||||
$entity_form['field_menace_maintien']['widget']['#description'] = FieldFilteredMarkup::create("Pouvez-vous décrire en quoi l'action $mm_string \"$concernement_title\" ?");
|
||||
$entity_form['field_menace_maintien']['widget'][0]['#description'] = FieldFilteredMarkup::create("Pouvez-vous décrire en quoi l'action $mm_string \"$concernement_title\" ?");
|
||||
$entity_form['field_menace_maintien']['widget'][0]['value']['#description'] = FieldFilteredMarkup::create("Pouvez-vous décrire en quoi l'action $mm_string \"$concernement_title\" ?");
|
||||
|
||||
|
||||
// field SOURCES
|
||||
// Comment avez-vous eu connaissance de cette menace / ce maintient ?
|
||||
$mm_string = "cette menace / ce maintient";
|
||||
if ($mm > 0) {
|
||||
$mm_string = "ce maintient";
|
||||
} else if ($mm < 0) {
|
||||
$mm_string = "cette menace";
|
||||
}
|
||||
|
||||
$entity_form['field_sources']['widget']['#description'] = FieldFilteredMarkup::create("Comment avez-vous eu connaissance de $mm_string ?");
|
||||
}
|
||||
|
||||
|
||||
@@ -91,11 +122,5 @@ function ouatt_admin_inline_entity_form_reference_form_alter(&$reference_form, &
|
||||
* @see \Drupal\inline_entity_form\InlineFormInterface::getTableFields()
|
||||
*/
|
||||
function ouatt_admin_inline_entity_form_table_fields_alter($fields, $context) {
|
||||
if ($context['entity_type'] == 'commerce_product_variation') {
|
||||
$fields['field_category'] = [
|
||||
'type' => 'field',
|
||||
'label' => t('Category'),
|
||||
'weight' => 101,
|
||||
];
|
||||
}
|
||||
$t="t";
|
||||
}
|
||||
@@ -156,12 +156,36 @@
|
||||
|
||||
#node-concernement-edit-form{}
|
||||
|
||||
#node-concernement-edit-form .layout-region-node-secondary{
|
||||
position: fixed;
|
||||
background-color: #fff;
|
||||
bottom:0; left:2.5em;
|
||||
width:200px;
|
||||
}
|
||||
#node-concernement-edit-form .layout-region-node-secondary >*{
|
||||
font-size: 0.765em;
|
||||
}
|
||||
|
||||
#node-concernement-edit-form .layout-region-node-secondary #edit-actions{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
#node-concernement-edit-form .layout-region-node-secondary #edit-actions input,
|
||||
#node-concernement-edit-form .layout-region-node-secondary #edit-actions a{
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
}
|
||||
/* #node-concernement-edit-form .layout-region-node-secondary #edit-actions a.button--danger{
|
||||
margin-top: 2em;
|
||||
} */
|
||||
|
||||
#node-concernement-edit-form .vertical-tabs__menu{
|
||||
/* width: auto; */
|
||||
max-width:110px;
|
||||
max-width:200px;
|
||||
}
|
||||
#node-concernement-edit-form .vertical-tabs__panes{
|
||||
margin-left: 110px;
|
||||
margin-left: 200px;
|
||||
}
|
||||
|
||||
#boussole-layout{
|
||||
@@ -288,6 +312,11 @@ div.field--name-field-menace-maintien-degres.form-wrapper{
|
||||
flex:0 1 auto;
|
||||
} */
|
||||
|
||||
div.field--name-field-action.form-wrapper label,
|
||||
div.field--name-field-menace-maintien label{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#boussole-layout .form-item[data-drupal-selector="edit-field-entite"] .button{
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ function ouatminimal_form_node_form_alter(&$form, FormStateInterface $form_state
|
||||
$form['#theme'] = ['node_edit_form'];
|
||||
$form['#attached']['library'][] = 'seven/node-form';
|
||||
|
||||
// unset($form['advanced']);
|
||||
$form['advanced']['#type'] = 'container';
|
||||
$form['meta']['#type'] = 'container';
|
||||
$form['meta']['#access'] = TRUE;
|
||||
@@ -63,6 +64,9 @@ function ouatminimal_form_node_form_alter(&$form, FormStateInterface $form_state
|
||||
|
||||
$form['revision_information']['#type'] = 'container';
|
||||
$form['revision_information']['#group'] = 'meta';
|
||||
|
||||
// $form['author']['#group']['group_admin'];
|
||||
|
||||
}
|
||||
|
||||
// https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/function/hook_theme_suggestions_HOOK_alter/10
|
||||
@@ -114,4 +118,8 @@ function ouatminimal_preprocess_form_element(&$variables) {
|
||||
if(isset($variables['description_display'])){
|
||||
$variables['description_display']="before";
|
||||
}
|
||||
}
|
||||
|
||||
function ouatminimal_preprocess_node_edit_form__node_concernement(&$variables) {
|
||||
$variables['form']['advanced']['#group'] = "group_admin";
|
||||
}
|
||||
@@ -22,18 +22,19 @@
|
||||
</div>
|
||||
<div class="layout-region layout-region-node-center clearfix">
|
||||
<div class="layout-region layout-region-node-main">
|
||||
{# {{ form|without('title','advanced', 'footer', 'actions', 'group_internal') }} #}
|
||||
{{ form|without('title','footer') }}
|
||||
{{ form|without('title','advanced', 'footer', 'actions', 'group_internal') }}
|
||||
{# {{ form|without('title','footer') }} #}
|
||||
{# {{ form }} #}
|
||||
</div>
|
||||
{# <div class="layout-region layout-region-node-secondary">
|
||||
<div class="layout-region layout-region-node-secondary">
|
||||
{{ form.group_internal }}
|
||||
{{ form.advanced }}
|
||||
{{ form.actions }}
|
||||
</div> #}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout-region layout-region-node-footer">
|
||||
{# <div class="layout-region layout-region-node-footer">
|
||||
<div class="layout-region-node-footer__content">
|
||||
{{ form.footer }}
|
||||
</div>
|
||||
</div>
|
||||
</div> #}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user