Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e0a888fa9 | |||
| 5d3905632d | |||
| fce467fa87 | |||
| f08406ec12 | |||
| f3d4c857e0 |
@@ -68,12 +68,12 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#eventfilters .widget-select.active .ss-main {
|
#eventfilters .widget-select.active .ts-control {
|
||||||
outline: 2px solid currentColor;
|
outline: 2px solid currentColor;
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#eventfilters .ss-main:focus-visible {
|
#eventfilters .ts-control:focus-within {
|
||||||
outline: 2px solid currentColor;
|
outline: 2px solid currentColor;
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
@@ -81,10 +81,14 @@
|
|||||||
#eventfilters .eventfilter-reset[hidden] {
|
#eventfilters .eventfilter-reset[hidden] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#eventfilters .ts-dropdown-content {
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/slim-select@3/dist/slimselect.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/slim-select@3/dist/slimselect.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/js/tom-select.complete.min.js"></script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const filters = document.getElementById('eventfilters');
|
const filters = document.getElementById('eventfilters');
|
||||||
@@ -117,25 +121,27 @@
|
|||||||
let currentFilter = { type: 'all', value: 'all' };
|
let currentFilter = { type: 'all', value: 'all' };
|
||||||
let suppressedChangeEvents = 0;
|
let suppressedChangeEvents = 0;
|
||||||
|
|
||||||
const initSlimSelect = (selectElement) => {
|
const initTomSelect = (selectElement) => {
|
||||||
if (!selectElement || 'undefined' === typeof window.SlimSelect) {
|
if (!selectElement || 'undefined' === typeof window.TomSelect) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new window.SlimSelect({
|
return new window.TomSelect(selectElement, {
|
||||||
select: selectElement,
|
create: false,
|
||||||
settings: {
|
maxItems: 1,
|
||||||
showSearch: false,
|
closeAfterSelect: true,
|
||||||
allowDeselect: false,
|
allowEmptyOption: true,
|
||||||
},
|
searchField: [],
|
||||||
|
controlInput: null,
|
||||||
|
dropdownParent: selectElement.closest('.widget-select') || undefined,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const tagSlim = initSlimSelect(tagSelect);
|
const tagTom = initTomSelect(tagSelect);
|
||||||
const locationSlim = initSlimSelect(locationSelect);
|
const locationTom = initTomSelect(locationSelect);
|
||||||
const orgSlim = initSlimSelect(orgSelect);
|
const orgTom = initTomSelect(orgSelect);
|
||||||
|
|
||||||
const setSelectValue = (selectElement, slimInstance, value) => {
|
const setSelectValue = (selectElement, tomInstance, value) => {
|
||||||
if (!selectElement) {
|
if (!selectElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -147,8 +153,8 @@
|
|||||||
suppressedChangeEvents += 1;
|
suppressedChangeEvents += 1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (slimInstance) {
|
if (tomInstance) {
|
||||||
slimInstance.setSelected(value);
|
tomInstance.setValue(value, true);
|
||||||
} else {
|
} else {
|
||||||
selectElement.value = value;
|
selectElement.value = value;
|
||||||
}
|
}
|
||||||
@@ -280,8 +286,8 @@
|
|||||||
|
|
||||||
const selectedValue = tagSelect.value;
|
const selectedValue = tagSelect.value;
|
||||||
|
|
||||||
setSelectValue(locationSelect, locationSlim, 'all');
|
setSelectValue(locationSelect, locationTom, 'all');
|
||||||
setSelectValue(orgSelect, orgSlim, 'all');
|
setSelectValue(orgSelect, orgTom, 'all');
|
||||||
|
|
||||||
applyFilter(
|
applyFilter(
|
||||||
selectedValue === 'all'
|
selectedValue === 'all'
|
||||||
@@ -297,8 +303,8 @@
|
|||||||
|
|
||||||
const selectedValue = locationSelect.value;
|
const selectedValue = locationSelect.value;
|
||||||
|
|
||||||
setSelectValue(tagSelect, tagSlim, 'all');
|
setSelectValue(tagSelect, tagTom, 'all');
|
||||||
setSelectValue(orgSelect, orgSlim, 'all');
|
setSelectValue(orgSelect, orgTom, 'all');
|
||||||
|
|
||||||
applyFilter(
|
applyFilter(
|
||||||
selectedValue === 'all'
|
selectedValue === 'all'
|
||||||
@@ -314,8 +320,8 @@
|
|||||||
|
|
||||||
const selectedValue = orgSelect.value;
|
const selectedValue = orgSelect.value;
|
||||||
|
|
||||||
setSelectValue(tagSelect, tagSlim, 'all');
|
setSelectValue(tagSelect, tagTom, 'all');
|
||||||
setSelectValue(locationSelect, locationSlim, 'all');
|
setSelectValue(locationSelect, locationTom, 'all');
|
||||||
|
|
||||||
applyFilter(
|
applyFilter(
|
||||||
selectedValue === 'all'
|
selectedValue === 'all'
|
||||||
@@ -325,12 +331,114 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
resetButton?.addEventListener('click', () => {
|
resetButton?.addEventListener('click', () => {
|
||||||
setSelectValue(tagSelect, tagSlim, 'all');
|
setSelectValue(tagSelect, tagTom, 'all');
|
||||||
setSelectValue(locationSelect, locationSlim, 'all');
|
setSelectValue(locationSelect, locationTom, 'all');
|
||||||
setSelectValue(orgSelect, orgSlim, 'all');
|
setSelectValue(orgSelect, orgTom, 'all');
|
||||||
|
|
||||||
applyFilter({ type: 'all', value: 'all' });
|
applyFilter({ type: 'all', value: 'all' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getDropdownFromTarget = (target) => {
|
||||||
|
if (!(target instanceof Element)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return target.closest('.ts-dropdown-content, .ts-dropdown');
|
||||||
|
};
|
||||||
|
|
||||||
|
const getScrollContainer = (targetDropdown) => {
|
||||||
|
if (!targetDropdown) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targetDropdown.scrollHeight > targetDropdown.clientHeight) {
|
||||||
|
return targetDropdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dropdownContent = targetDropdown.classList.contains('ts-dropdown-content')
|
||||||
|
? targetDropdown
|
||||||
|
: targetDropdown.querySelector('.ts-dropdown-content');
|
||||||
|
|
||||||
|
if (dropdownContent && dropdownContent.scrollHeight > dropdownContent.clientHeight) {
|
||||||
|
return dropdownContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const shouldBlockBoundaryScroll = (scrollContainer, delta) => {
|
||||||
|
if (!scrollContainer || delta === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const top = scrollContainer.scrollTop;
|
||||||
|
const height = scrollContainer.clientHeight;
|
||||||
|
const scrollHeight = scrollContainer.scrollHeight;
|
||||||
|
|
||||||
|
const atTop = top <= 0;
|
||||||
|
const atBottom = top + height >= scrollHeight - 1;
|
||||||
|
|
||||||
|
return (atTop && delta < 0) || (atBottom && delta > 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
let lastTouchY = null;
|
||||||
|
|
||||||
|
document.addEventListener('wheel', (event) => {
|
||||||
|
const dropdown = getDropdownFromTarget(event.target);
|
||||||
|
if (!dropdown) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scrollContainer = getScrollContainer(dropdown);
|
||||||
|
|
||||||
|
if (shouldBlockBoundaryScroll(scrollContainer, event.deltaY)) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
}, { passive: false, capture: true });
|
||||||
|
|
||||||
|
document.addEventListener('touchstart', (event) => {
|
||||||
|
const dropdown = getDropdownFromTarget(event.target);
|
||||||
|
if (!dropdown || event.touches.length === 0) {
|
||||||
|
lastTouchY = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastTouchY = event.touches[0].clientY;
|
||||||
|
}, { passive: true, capture: true });
|
||||||
|
|
||||||
|
document.addEventListener('touchmove', (event) => {
|
||||||
|
const dropdown = getDropdownFromTarget(event.target);
|
||||||
|
if (!dropdown || event.touches.length === 0 || lastTouchY === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scrollContainer = getScrollContainer(dropdown);
|
||||||
|
|
||||||
|
if (!scrollContainer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentTouchY = event.touches[0].clientY;
|
||||||
|
const delta = lastTouchY - currentTouchY;
|
||||||
|
|
||||||
|
if (shouldBlockBoundaryScroll(scrollContainer, delta)) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
lastTouchY = currentTouchY;
|
||||||
|
}, { passive: false, capture: true });
|
||||||
|
|
||||||
|
document.addEventListener('touchend', () => {
|
||||||
|
lastTouchY = null;
|
||||||
|
}, { passive: true, capture: true });
|
||||||
|
|
||||||
|
document.addEventListener('touchcancel', () => {
|
||||||
|
lastTouchY = null;
|
||||||
|
}, { passive: true, capture: true });
|
||||||
|
|
||||||
applyFilter(currentFilter);
|
applyFilter(currentFilter);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -55,16 +55,10 @@ class OrganizationListingTemplateDataListener
|
|||||||
$organizationTagMap = $this->fetchOrganizationTagMap($organizationIds);
|
$organizationTagMap = $this->fetchOrganizationTagMap($organizationIds);
|
||||||
$organizationLogoUuidMap = $this->fetchOrganizationLogoUuidMap($organizationIds);
|
$organizationLogoUuidMap = $this->fetchOrganizationLogoUuidMap($organizationIds);
|
||||||
|
|
||||||
$organizationTagIdsMap = [];
|
|
||||||
$organizationTagLabelMap = [];
|
$organizationTagLabelMap = [];
|
||||||
$rowTagIdsMap = [];
|
|
||||||
$rowTagIdsList = [];
|
$rowTagIdsList = [];
|
||||||
|
|
||||||
foreach ($organizationTagMap as $organizationId => $tagData) {
|
foreach ($organizationTagMap as $tagData) {
|
||||||
if ([] !== ($tagData['ids'] ?? [])) {
|
|
||||||
$organizationTagIdsMap[(string) $organizationId] = implode(',', $tagData['ids']);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (($tagData['ids'] ?? []) as $index => $tagId) {
|
foreach (($tagData['ids'] ?? []) as $index => $tagId) {
|
||||||
$label = trim((string) (($tagData['labels'][$index] ?? '') ?: ''));
|
$label = trim((string) (($tagData['labels'][$index] ?? '') ?: ''));
|
||||||
|
|
||||||
@@ -79,26 +73,15 @@ class OrganizationListingTemplateDataListener
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tagData = $organizationTagMap[$organizationId] ?? ['ids' => [], 'labels' => [], 'slugs' => []];
|
$tagData = $organizationTagMap[$organizationId] ?? ['ids' => [], 'labels' => []];
|
||||||
$logoUuid = $organizationLogoUuidMap[$organizationId] ?? '';
|
$logoUuid = $organizationLogoUuidMap[$organizationId] ?? '';
|
||||||
$tagIdsCsv = implode(',', $tagData['ids']);
|
$tagIdsCsv = implode(',', $tagData['ids']);
|
||||||
$tagLabelsCsv = implode(', ', $tagData['labels']);
|
$tagLabelsCsv = implode(', ', $tagData['labels']);
|
||||||
$tagSlugsCsv = implode(',', $tagData['slugs']);
|
|
||||||
|
|
||||||
$tbody[$rowIndex]['tag_ids']['content'] = $tagIdsCsv;
|
$tbody[$rowIndex]['tag_ids']['content'] = $tagIdsCsv;
|
||||||
$tbody[$rowIndex]['tag_labels']['content'] = $tagLabelsCsv;
|
$tbody[$rowIndex]['tag_labels']['content'] = $tagLabelsCsv;
|
||||||
$tbody[$rowIndex]['tag_slugs']['content'] = $tagSlugsCsv;
|
|
||||||
$tbody[$rowIndex]['tags']['content'] = $tagLabelsCsv;
|
$tbody[$rowIndex]['tags']['content'] = $tagLabelsCsv;
|
||||||
|
|
||||||
$tbody[$rowIndex]['tag_ids'] = $tagIdsCsv;
|
|
||||||
$tbody[$rowIndex]['tag_labels'] = $tagLabelsCsv;
|
|
||||||
$tbody[$rowIndex]['tag_slugs'] = $tagSlugsCsv;
|
|
||||||
$tbody[$rowIndex]['tags'] = $tagLabelsCsv;
|
|
||||||
|
|
||||||
if ('' !== $tagIdsCsv) {
|
|
||||||
$rowTagIdsMap[(string) $rowIndex] = $tagIdsCsv;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('' !== $logoUuid) {
|
if ('' !== $logoUuid) {
|
||||||
$tbody[$rowIndex]['logo_uuid']['content'] = $logoUuid;
|
$tbody[$rowIndex]['logo_uuid']['content'] = $logoUuid;
|
||||||
}
|
}
|
||||||
@@ -119,7 +102,7 @@ class OrganizationListingTemplateDataListener
|
|||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
$rowsWithoutTagIds = 0;
|
$rowsWithoutTagIds = 0;
|
||||||
|
|
||||||
foreach ($rowToOrganizationIdMap as $rowIndex => $organizationId) {
|
foreach ($rowToOrganizationIdMap as $organizationId) {
|
||||||
if (!isset($organizationTagMap[$organizationId]) || [] === ($organizationTagMap[$organizationId]['ids'] ?? [])) {
|
if (!isset($organizationTagMap[$organizationId]) || [] === ($organizationTagMap[$organizationId]['ids'] ?? [])) {
|
||||||
++$rowsWithoutTagIds;
|
++$rowsWithoutTagIds;
|
||||||
}
|
}
|
||||||
@@ -135,9 +118,7 @@ class OrganizationListingTemplateDataListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->organization_tag_ids_map = $organizationTagIdsMap;
|
|
||||||
$template->organization_tag_label_map = $organizationTagLabelMap;
|
$template->organization_tag_label_map = $organizationTagLabelMap;
|
||||||
$template->organization_row_tag_ids_map = $rowTagIdsMap;
|
|
||||||
$template->organization_row_tag_ids_list = $rowTagIdsList;
|
$template->organization_row_tag_ids_list = $rowTagIdsList;
|
||||||
|
|
||||||
$template->tbody = $tbody;
|
$template->tbody = $tbody;
|
||||||
@@ -229,7 +210,7 @@ class OrganizationListingTemplateDataListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @param list<int> $organizationIds
|
/** @param list<int> $organizationIds
|
||||||
* @return array<int, array{ids: list<string>, labels: list<string>, slugs: list<string>}>
|
* @return array<int, array{ids: list<string>, labels: list<string>}>
|
||||||
*/
|
*/
|
||||||
private function fetchOrganizationTagMap(array $organizationIds): array
|
private function fetchOrganizationTagMap(array $organizationIds): array
|
||||||
{
|
{
|
||||||
@@ -237,46 +218,25 @@ class OrganizationListingTemplateDataListener
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope = $this->resolveTagRelationScope($organizationIds);
|
|
||||||
|
|
||||||
$conditions = ['r.pid IN (?)'];
|
|
||||||
$params = [$organizationIds];
|
|
||||||
$types = [ArrayParameterType::INTEGER];
|
|
||||||
|
|
||||||
if ('' === $scope['ptable']) {
|
|
||||||
$conditions[] = "(r.ptable = '' OR r.ptable IS NULL)";
|
|
||||||
} else {
|
|
||||||
$conditions[] = 'r.ptable = ?';
|
|
||||||
$params[] = $scope['ptable'];
|
|
||||||
$types[] = ParameterType::STRING;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('' === $scope['field']) {
|
|
||||||
$conditions[] = "(r.field = '' OR r.field IS NULL)";
|
|
||||||
} else {
|
|
||||||
$conditions[] = 'r.field = ?';
|
|
||||||
$params[] = $scope['field'];
|
|
||||||
$types[] = ParameterType::STRING;
|
|
||||||
}
|
|
||||||
|
|
||||||
$rows = $this->connection->executeQuery(
|
$rows = $this->connection->executeQuery(
|
||||||
'SELECT r.pid AS organization_id, r.tag_id, t.tag AS label FROM tl_tags_rel r INNER JOIN tl_tags t ON t.id = r.tag_id WHERE '.implode(' AND ', $conditions).' ORDER BY r.pid ASC, r.tag_id ASC',
|
'SELECT r.pid AS organization_id, r.tag_id, t.tag AS label
|
||||||
$params,
|
FROM tl_tags_rel r
|
||||||
$types,
|
INNER JOIN tl_tags t ON t.id = r.tag_id
|
||||||
|
WHERE r.ptable = ? AND r.field = ? AND r.pid IN (?)
|
||||||
|
ORDER BY r.pid ASC, r.tag_id ASC',
|
||||||
|
['tl_organization', 'tags', $organizationIds],
|
||||||
|
[ParameterType::STRING, ParameterType::STRING, ArrayParameterType::INTEGER],
|
||||||
)->fetchAllAssociative();
|
)->fetchAllAssociative();
|
||||||
|
|
||||||
if ([] === $rows && '' !== $scope['field']) {
|
if ([] === $rows) {
|
||||||
$fieldFreeConditions = array_values(array_filter($conditions, static fn (string $condition): bool => 'r.field = ?' !== $condition));
|
|
||||||
$fieldFreeParams = $params;
|
|
||||||
$fieldFreeTypes = $types;
|
|
||||||
|
|
||||||
array_pop($fieldFreeParams);
|
|
||||||
array_pop($fieldFreeTypes);
|
|
||||||
|
|
||||||
$rows = $this->connection->executeQuery(
|
$rows = $this->connection->executeQuery(
|
||||||
'SELECT r.pid AS organization_id, r.tag_id, t.tag AS label FROM tl_tags_rel r INNER JOIN tl_tags t ON t.id = r.tag_id WHERE '.implode(' AND ', $fieldFreeConditions).' ORDER BY r.pid ASC, r.tag_id ASC',
|
'SELECT r.pid AS organization_id, r.tag_id, t.tag AS label
|
||||||
$fieldFreeParams,
|
FROM tl_tags_rel r
|
||||||
$fieldFreeTypes,
|
INNER JOIN tl_tags t ON t.id = r.tag_id
|
||||||
|
WHERE r.ptable = ? AND r.pid IN (?)
|
||||||
|
ORDER BY r.pid ASC, r.tag_id ASC',
|
||||||
|
['tl_organization', $organizationIds],
|
||||||
|
[ParameterType::STRING, ArrayParameterType::INTEGER],
|
||||||
)->fetchAllAssociative();
|
)->fetchAllAssociative();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,62 +255,16 @@ class OrganizationListingTemplateDataListener
|
|||||||
$seen[$organizationId][$tagId] = true;
|
$seen[$organizationId][$tagId] = true;
|
||||||
$map[$organizationId]['ids'][] = (string) $tagId;
|
$map[$organizationId]['ids'][] = (string) $tagId;
|
||||||
$map[$organizationId]['labels'][] = $label;
|
$map[$organizationId]['labels'][] = $label;
|
||||||
|
|
||||||
$slug = $this->slugify($label);
|
|
||||||
|
|
||||||
if ('' !== $slug) {
|
|
||||||
$map[$organizationId]['slugs'][] = $slug;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($map as $organizationId => $tagData) {
|
foreach ($map as $organizationId => $tagData) {
|
||||||
$map[$organizationId]['ids'] = array_values(array_unique($tagData['ids'] ?? []));
|
$map[$organizationId]['ids'] = array_values(array_unique($tagData['ids'] ?? []));
|
||||||
$map[$organizationId]['labels'] = array_values(array_unique($tagData['labels'] ?? []));
|
$map[$organizationId]['labels'] = array_values(array_unique($tagData['labels'] ?? []));
|
||||||
$map[$organizationId]['slugs'] = array_values(array_unique($tagData['slugs'] ?? []));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $map;
|
return $map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param list<int> $organizationIds
|
|
||||||
* @return array{ptable: string, field: string}
|
|
||||||
*/
|
|
||||||
private function resolveTagRelationScope(array $organizationIds): array
|
|
||||||
{
|
|
||||||
$rows = $this->connection->executeQuery(
|
|
||||||
"SELECT COALESCE(NULLIF(TRIM(r.ptable), ''), '') AS ptable_scope, COALESCE(NULLIF(TRIM(r.field), ''), '') AS field_scope, COUNT(DISTINCT r.pid) AS pid_count, COUNT(*) AS rel_count FROM tl_tags_rel r WHERE r.pid IN (?) GROUP BY COALESCE(NULLIF(TRIM(r.ptable), ''), ''), COALESCE(NULLIF(TRIM(r.field), ''), '') ORDER BY pid_count DESC, rel_count DESC",
|
|
||||||
[$organizationIds],
|
|
||||||
[ArrayParameterType::INTEGER],
|
|
||||||
)->fetchAllAssociative();
|
|
||||||
|
|
||||||
if ([] === $rows) {
|
|
||||||
return ['ptable' => 'tl_organization', 'field' => 'tags'];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
if ('tl_organization' === (string) ($row['ptable_scope'] ?? '') && 'tags' === (string) ($row['field_scope'] ?? '')) {
|
|
||||||
return ['ptable' => 'tl_organization', 'field' => 'tags'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
if ('tl_organization' === (string) ($row['ptable_scope'] ?? '')) {
|
|
||||||
return ['ptable' => 'tl_organization', 'field' => (string) ($row['field_scope'] ?? '')];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
if ('tags' === (string) ($row['field_scope'] ?? '')) {
|
|
||||||
return ['ptable' => (string) ($row['ptable_scope'] ?? ''), 'field' => 'tags'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
'ptable' => (string) ($rows[0]['ptable_scope'] ?? 'tl_organization'),
|
|
||||||
'field' => (string) ($rows[0]['field_scope'] ?? 'tags'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @param list<int> $organizationIds
|
/** @param list<int> $organizationIds
|
||||||
* @return array<int, string>
|
* @return array<int, string>
|
||||||
*/
|
*/
|
||||||
@@ -409,24 +323,4 @@ class OrganizationListingTemplateDataListener
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function slugify(string $value): string
|
|
||||||
{
|
|
||||||
$value = trim(mb_strtolower($value));
|
|
||||||
|
|
||||||
if ('' === $value) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$value = strtr($value, [
|
|
||||||
'ä' => 'ae',
|
|
||||||
'ö' => 'oe',
|
|
||||||
'ü' => 'ue',
|
|
||||||
'ß' => 'ss',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$value = preg_replace('/[^a-z0-9]+/u', '-', $value) ?? '';
|
|
||||||
$value = trim($value, '-');
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user