Files
materio-d9/web/modules/custom/materio_admin/materio_admin.module
T
2026-09-29 00:05:08 +02:00

28 lines
1.0 KiB
PHP

<?php
/**
* @file
* Admin back-office enhancements.
*/
/**
* 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';
}
}