|
@@ -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";
|
|
|
}
|