Browse Source

fixed downloads

main
astanley 1 day ago
parent
commit
a34af5585d
  1. 12
      css/metadata_profile.css
  2. 24
      src/Controller/MetadataProfileController.php

12
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 */
}

24
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,11 +836,17 @@ class MetadataProfileController extends ControllerBase {
}
else {
if (is_array($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);
}
}
}
}
}
return $rows;
}
@ -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
? '<span class="yes-icon" title="Yes"></span>'
: '<span class="no-icon" title="No"></span>',
? "<span class='yes-icon' title='$tooltip'></span>"
: "<span class='no-icon' title='Not {$tooltip}'></span>",
],
];
}

Loading…
Cancel
Save