term_reference_tree bug fix

This commit is contained in:
2026-09-29 00:05:08 +02:00
parent 6b8c1d9353
commit 9136dc3ddb
4 changed files with 12 additions and 22 deletions
+1 -1
View File
@@ -265,7 +265,7 @@
"Exposed operators are not included in fieldsets https://www.drupal.org/project/views_ef_fieldset/issues/3173822": "https://git.drupalcode.org/project/views_ef_fieldset/-/merge_requests/1/diffs.patch"
},
"drupal/term_reference_tree": {
"Term Reference Tree: Re-implement Track List https://www.drupal.org/project/term_reference_tree/issues/3064280": "https://www.drupal.org/files/issues/2026-09-24/term_reference_tree-3064280-tracklist-2.0.3.patch"
"Term Reference Tree: Re-implement Track List https://www.drupal.org/project/term_reference_tree/issues/3064280": "https://www.drupal.org/files/issues/2026-09-29/term_reference_tree-3064280_bring_back_tracklist-25.patch"
},
"drupal/workflow": {
"Restore ^11 on submodule info.yml, lost in #3607490 regression https://www.drupal.org/project/workflow/issues/3607490": "./patches/workflow-3607490-submodule-info-d11-2.1.13.patch"
Generated
+1 -1
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": "829c4774582ddf65006e45de87cb6763",
"content-hash": "c66fde73c02a835261fbc5e72f018d42",
"packages": [
{
"name": "asm89/stack-cors",
@@ -313,7 +313,7 @@ content:
weight: 35
region: content
settings:
start_minimized: false
start_minimized: true
leaves_only: false
select_parents: false
cascading_selection: 0
@@ -5,33 +5,23 @@
* Admin back-office enhancements.
*/
use Drupal\term_reference_tree\Plugin\Field\FieldWidget\TermReferenceTree;
/**
* Implements hook_field_widget_single_element_form_alter().
*
* Attaches the widget layout library wherever the term reference tree widget
* renders (thesaurus on materiau, etc.), so the selection tree (left) and the
* sortable track list (right) sit side by side.
*
* Transposed from the retired matminimal theme CSS, which was tied to the old
* adminimal-based admin theme. The selectors target the widget's own markup
* classes and are admin-theme agnostic (works under Gin 4 and Gin 5).
*/
function materio_admin_field_widget_single_element_form_alter(array &$element, \Drupal\Core\Form\FormStateInterface $form_state, array $context) {
if (isset($context['widget']) && $context['widget'] instanceof TermReferenceTree) {
$element['#attached']['library'][] = 'materio_admin/term_reference_tree';
}
}
/**
* Implements hook_page_attachments().
*
* Loads the general admin table styling on every admin route (compact
* paddings + constrained widths, replacing the old matminimal rules).
*
* Also loads the term reference tree widget layout (selection tree left,
* sortable track list right) on admin routes. Attaching it here instead of
* hook_field_widget_single_element_form_alter() keeps the widget element's
* own #attached libraries intact: setting #attached in that alter hook
* prevented FormBuilder's element-info defaults merge ($element += $info)
* from applying the checkbox_tree element #attached, which silently dropped
* term_reference_tree/term_reference_tree_js and _css.
*/
function materio_admin_page_attachments(array &$attachments) {
if (\Drupal::service('router.admin_context')->isAdminRoute()) {
$attachments['#attached']['library'][] = 'materio_admin/admin_tables';
$attachments['#attached']['library'][] = 'materio_admin/term_reference_tree';
}
}