Commit 1692a100 authored by Jörg Bösche's avatar Jörg Bösche Committed by Jan Helke
Browse files

[FEATURE] Exclude doktypes in path of search result

The search result has a path with the pagetree structure.
It must be possible to exclude doktypes from the path.

Releases: master
Resolves: #82070
Change-Id: I15d6bb0765aa237ab86cb75e6ffff0c26d8f504d
Reviewed-on: https://review.typo3.org/53671


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Reviewed-by: Frans Saris's avatarFrans Saris <franssaris@gmail.com>
Tested-by: Frans Saris's avatarFrans Saris <franssaris@gmail.com>
Reviewed-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Reviewed-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: Jan Helke's avatarJan Helke <typo3@helke.de>
parent 49edc90c
.. include:: ../../Includes.txt
============================================================================
Feature: #82070 - Exclude doktypes in path of search result (indexed_search)
============================================================================
See :issue:`82070`
Description
===========
After submitting the search form in Indexed Search, the search results are displayed.
Each search result displays a "path" and contains the page tree structure.
In the structure, system folders can be used, which actually can't be excluded when the path is rendered.
Similar to "hide in menu" or "RealUrl exclude from path segment", there should be a configuration to exclude doktypes
from the path render business logic.
Page tree structure:
[SysFolder] Footer -> [SysFolder] Navigation -> [Page] Imprint
Output in Indexed Search without :php:`pathExcludeDoktypes` settings:
:php:`/Footer/Navigation/Imprint`
Output in Indexed Search with :php:`pathExcludeDoktypes` settings:
:php:`/Imprint`
Examples
~~~~~~~~
Exclude single doktype
**********************
sys_folder (doktype: 254)
.. code-block:: typoscript
plugin.tx_indexedsearch {
settings {
results {
pathExcludeDoktypes = 254
}
}
}
Exclude multiple doktypes
*************************
sys_folder (doktype: 254) and shortcuts (doktype:4)
.. code-block:: typoscript
plugin.tx_indexedsearch {
settings {
results {
pathExcludeDoktypes = 254,4
}
}
}
.. index:: Frontend, ext:indexed_search, TypoScript
......@@ -1408,10 +1408,18 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
$path = '';
$pageCount = count($rl);
if (is_array($rl) && !empty($rl)) {
$excludeDoktypesFromPath = GeneralUtility::trimExplode(
',',
$this->settings['results']['pathExcludeDoktypes'] ?? '',
true
);
$breadcrumbWrap = isset($this->settings['breadcrumbWrap']) ? $this->settings['breadcrumbWrap'] : '/';
$breadcrumbWraps = GeneralUtility::makeInstance(TypoScriptService::class)
->explodeConfigurationForOptionSplit(['wrap' => $breadcrumbWrap], $pageCount);
foreach ($rl as $k => $v) {
if (in_array($v['doktype'], $excludeDoktypesFromPath, false)) {
continue;
}
// Check fe_user
if ($v['fe_group'] && ($v['uid'] == $id || $v['extendToSubpages'])) {
$this->requiredFrontendUsergroups[$id][] = $v['fe_group'];
......
......@@ -49,6 +49,7 @@ plugin.tx_indexedsearch {
markupSW_postPreLgd_offset = 5
markupSW_divider = ...
markupSW_divider.noTrimWrap = | | |
pathExcludeDoktypes =
}
# Blinding of option-selectors / values in these (advanced search)
......
......@@ -603,6 +603,33 @@ results\_markupSW_divider
Divider for highlighted searchwords in the summary
Defaults to "..."
.. _results-pathExcludeDoktypes:
results\_pathExcludeDoktypes
""""""""""""""""""""""""""""
.. container:: table-row
Property
results\_pathExcludeDoktypes
Data type
string
Description
Excludes doktypes in path.
Defaults to ""
**Example:**
pathExcludeDoktypes = 254
Exclude sys_folder (doktype: 254) in path for result.
"/Footer(254)/Navi(254)/Imprint(1)" -> "/Imprint".
pathExcludeDoktypes = 254,4
Exclude sys_folder (doktype: 254) and shortcuts (doktype:4) in path for result.
"/About-Us(254)/Company(4)/Germany(1)" -> "/Germany".
.. _linkSectionTitles-stdWrap:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment