From a34af5585dfe8f5742c53e775c41692462e69fa7 Mon Sep 17 00:00:00 2001 From: astanley Date: Tue, 7 Apr 2026 11:47:18 -0300 Subject: [PATCH] fixed downloads --- css/metadata_profile.css | 12 +++++++++ src/Controller/MetadataProfileController.php | 26 ++++++++++++-------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/css/metadata_profile.css b/css/metadata_profile.css index 97c41f5..b375ddb 100644 --- a/css/metadata_profile.css +++ b/css/metadata_profile.css @@ -25,3 +25,15 @@ .no-icon { color: #c62828; } + +.scrolling-table-container { + max-height: 600px; /* or whatever */ + overflow-y: auto; +} + +.scrolling-table-container table thead th { + position: sticky; + top: 0; + z-index: 2; + background: white; /* IMPORTANT so text doesn't overlap */ +} diff --git a/src/Controller/MetadataProfileController.php b/src/Controller/MetadataProfileController.php index d04414a..cd41871 100644 --- a/src/Controller/MetadataProfileController.php +++ b/src/Controller/MetadataProfileController.php @@ -458,8 +458,8 @@ class MetadataProfileController extends ControllerBase { $field_profile['repeatable'], $field_profile['auto_create'], - $this->yesNoIcon($field_profile['search_api']['in_search_api']), - $this->YesNoIcon($field_profile['search_api']['has_facet']), + $this->yesNoIcon($field_profile['search_api']['in_search_api'],$this->t('In search api')), + $this->YesNoIcon($field_profile['search_api']['has_facet'], $this->t('Faceted')), $display ? $this->formatListForTable($bundles) : $bundles, @@ -619,7 +619,7 @@ class MetadataProfileController extends ControllerBase { protected function formatRequired(FieldDefinitionInterface $field_definition) { $cardinality = $field_definition->isRequired(); - return $this->yesNoIcon($cardinality); + return $this->yesNoIcon($cardinality, $this->t('Required')); } /** @@ -648,11 +648,11 @@ class MetadataProfileController extends ControllerBase { ->getCardinality(); if ($cardinality === 1) { - return $this->yesNoIcon($cardinality); + return $this->yesNoIcon(FALSE, $this->t("Repeatable")); } if ($cardinality === -1) { - return $this->yesNoIcon($cardinality); + return $this->yesNoIcon(TRUE, $this->t("Repeatable")); } return $this->t('Yes (max @limit)', [ @@ -671,7 +671,7 @@ class MetadataProfileController extends ControllerBase { $settings = $field_definition->getSetting('handler_settings') ?? []; $create_new = !empty($settings['auto_create']); - return $this->yesNoIcon($create_new); + return $this->yesNoIcon($create_new, $this->t("Creatable")); } protected function formatTargetBundles(FieldDefinitionInterface $field_definition) { @@ -836,7 +836,13 @@ class MetadataProfileController extends ControllerBase { } else { if (is_array($element)) { - $rows[$row_key][$element_key] = implode('|', $element); + if (isset($element['data']) && array_key_exists('#markup', $element['data'])) { + preg_match('/title=["\']([^"\']*)["\']/', $element['data']['#markup'], $matches); + $rows[$row_key][$element_key] = $matches[1] ?? null; + } + else { + $rows[$row_key][$element_key] = implode('|', $element); + } } } } @@ -998,12 +1004,12 @@ class MetadataProfileController extends ControllerBase { * @return array * Render array containing markup for the icon. */ - protected function yesNoIcon(bool $value): array { + protected function yesNoIcon(bool $value, string $tooltip = 'Used'): array { return [ 'data' => [ '#markup' => $value - ? '' - : '', + ? "" + : "", ], ]; }