From 32071e2bf597e2e343bee63e032d928ad0e6acea Mon Sep 17 00:00:00 2001 From: bach Date: Fri, 10 Mar 2023 17:49:59 +0100 Subject: [PATCH] concernement form concrnement title in entite ok --- src/config/sync/core.extension.yml | 1 + .../custom/ouatt_admin/ouatt_admin.info.yml | 8 ++ .../custom/ouatt_admin/ouatt_admin.module | 101 ++++++++++++++++++ .../ouatminimal_theme/css/ouatminimal.css | 4 +- .../ouatminimal_theme/ouatminimal.theme | 3 +- 5 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 src/web/modules/custom/ouatt_admin/ouatt_admin.info.yml create mode 100644 src/web/modules/custom/ouatt_admin/ouatt_admin.module diff --git a/src/config/sync/core.extension.yml b/src/config/sync/core.extension.yml index 266e944..dbc8e32 100644 --- a/src/config/sync/core.extension.yml +++ b/src/config/sync/core.extension.yml @@ -87,6 +87,7 @@ module: mysql: 0 node: 0 options: 0 + ouatt_admin: 0 ouatt_graphql: 0 ouatt_users: 0 page_cache: 0 diff --git a/src/web/modules/custom/ouatt_admin/ouatt_admin.info.yml b/src/web/modules/custom/ouatt_admin/ouatt_admin.info.yml new file mode 100644 index 0000000..93be184 --- /dev/null +++ b/src/web/modules/custom/ouatt_admin/ouatt_admin.info.yml @@ -0,0 +1,8 @@ +name: Où Atterrir Admin +type: module +description: 'Où Atterrir Admin.' +package: Ouatterrir +core: 8.x +# dependencies: +# - user +core_version_requirement: ^8 || ^9 diff --git a/src/web/modules/custom/ouatt_admin/ouatt_admin.module b/src/web/modules/custom/ouatt_admin/ouatt_admin.module new file mode 100644 index 0000000..3eba9dc --- /dev/null +++ b/src/web/modules/custom/ouatt_admin/ouatt_admin.module @@ -0,0 +1,101 @@ +' . t('About') . ''; + $output .= '

' . t('Où Atterrir admin twicks module') . '

'; + return $output; + + default: + } +} + + +/** + * Implements hook_form_FORM_ID_alter(). + */ +// function ouatt_admin_form_alter(&$form, $form_state, $form_id) { + +// } +function ouatt_admin_form_node_concernement_edit_form_alter(&$form, $form_state, $form_id) { + $concernement_node = $form_state->getFormObject()->getEntity(); + // concernement title + $concernement_title = $concernement_node->getTitle(); + $form_state->setTemporaryValue("concernement_title", $concernement_title); + // menace/maintien + + // actuel/future + +} + + +/** + * Perform alterations before an entity form is included in the IEF widget. + * + * @param array $entity_form + * Nested array of form elements that comprise the entity form. + * @param \Drupal\Core\Form\FormStateInterface $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 = $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\" ?"); +} + + +/** + * Perform alterations before the reference form is included in the IEF widget. + * + * The reference form is used to add existing entities through an autocomplete + * field. + * + * @param array $reference_form + * Nested array of form elements that comprise the reference form. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The form state of the parent form. + */ +function ouatt_admin_inline_entity_form_reference_form_alter(&$reference_form, &$form_state) { + $t="t"; +} + +/** + * Alter the fields used to represent an entity in the IEF table. + * + * @param array $fields + * The fields, keyed by field name. + * @param array $context + * An array with the following keys: + * - parent_entity_type: The type of the parent entity. + * - parent_bundle: The bundle of the parent entity. + * - field_name: The name of the reference field on which IEF is operating. + * - entity_type: The type of the referenced entities. + * - allowed_bundles: Bundles allowed on the reference field. + * + * @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, + ]; + } +} \ No newline at end of file diff --git a/src/web/themes/custom/ouatminimal_theme/css/ouatminimal.css b/src/web/themes/custom/ouatminimal_theme/css/ouatminimal.css index efbe28c..a27566d 100644 --- a/src/web/themes/custom/ouatminimal_theme/css/ouatminimal.css +++ b/src/web/themes/custom/ouatminimal_theme/css/ouatminimal.css @@ -254,11 +254,11 @@ max-width: 100%; } */ -/* div.field--name-field-actuel-future.form-wrapper, +div.field--name-field-actuel-future.form-wrapper, div.field--name-field-prise.form-wrapper, div.field--name-field-menace-maintien-degres.form-wrapper{ display: none; -} */ +} /* .field--name-field-actuel-future > fieldset legend{ display:none; } diff --git a/src/web/themes/custom/ouatminimal_theme/ouatminimal.theme b/src/web/themes/custom/ouatminimal_theme/ouatminimal.theme index 6d87e2c..b0cfa2e 100644 --- a/src/web/themes/custom/ouatminimal_theme/ouatminimal.theme +++ b/src/web/themes/custom/ouatminimal_theme/ouatminimal.theme @@ -111,8 +111,7 @@ function ouatminimal_preprocess_toolbar(&$variables) { } function ouatminimal_preprocess_form_element(&$variables) { - // $element = &$variables['element']; if(isset($variables['description_display'])){ - $variables['description_display']="before"; + $variables['description_display']="before"; } } \ No newline at end of file