switched admin theme to GIN (plus custom module for terme_reference_tree display)

This commit is contained in:
2026-09-23 20:39:00 +02:00
parent 82354d58b2
commit 0e59bf5129
49 changed files with 318 additions and 181 deletions
@@ -0,0 +1,17 @@
/**
* Term reference tree widget: selection tree on the left, sortable track
* list on the right. Transposed from the retired matminimal theme.
*/
.term-reference-tree > ul,
.term-reference-tree aside.term-reference-tree-track-list {
display: inline-block;
vertical-align: top;
}
.term-reference-tree > ul {
padding-right: 1em;
min-width: 45%;
}
.term-reference-tree aside.term-reference-tree-track-list {
border-left: 1px solid #aaa;
padding-left: 1em;
}
@@ -0,0 +1,7 @@
name: 'Materio Admin'
type: module
description: 'Admin back-office enhancements (widget layouts and theming support for the Gin admin theme).'
package: Materio
core_version_requirement: ^10 || ^11
dependencies:
- 'term_reference_tree'
@@ -0,0 +1,5 @@
term_reference_tree:
version: 1.0
css:
theme:
css/term-reference-tree.css: {}
@@ -0,0 +1,25 @@
<?php
/**
* @file
* 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';
}
}