Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index pages within "Link to External URL" (doktype=3) pages #145

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/DataCollector/PagesDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PagesDataCollector extends TcaDataCollector implements DataCollectorInterf
'pid' => 0,
'sysLanguageOverlay' => 1,
'doktypes' => ['1'],
'transientDoktypes' => ['4', '199'],
'transientDoktypes' => ['3', '4', '199'],
'groupWhereClause' => ' AND (pages.fe_group = "" OR pages.fe_group = 0)',
'includeHideInMenu' => false,
'mode' => 'whitelist',
Expand Down
62 changes: 62 additions & 0 deletions Tests/Functional/Service/IndexingServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,68 @@ public function indexesRecordsOfUnlocalizableTables(): void
);
}

/**
* @test
*/
public function indexesPagesWithinTransientPages(): void
{
$this->insertArray('pages', [
'uid' => 3,
'pid' => 1,
'doktype' => PageRepository::DOKTYPE_DEFAULT,
'title' => 'Regular page',
]);
$this->insertArray('pages', [
'uid' => 4,
'pid' => 1,
'doktype' => PageRepository::DOKTYPE_LINK,
'title' => 'Link page',
]);
$this->insertArray('pages', [
'uid' => 5,
'pid' => 4,
'doktype' => PageRepository::DOKTYPE_DEFAULT,
'title' => 'Link nested page',
]);
$this->insertArray('pages', [
'uid' => 6,
'pid' => 1,
'doktype' => PageRepository::DOKTYPE_SHORTCUT,
'shortcut_mode' => PageRepository::SHORTCUT_MODE_FIRST_SUBPAGE,
'title' => 'Shortcut page',
]);
$this->insertArray('pages', [
'uid' => 7,
'pid' => 6,
'doktype' => PageRepository::DOKTYPE_DEFAULT,
'title' => 'Shortcut nested page',
]);
$this->insertArray('pages', [
'uid' => 8,
'pid' => 1,
'doktype' => PageRepository::DOKTYPE_SPACER,
'shortcut_mode' => PageRepository::SHORTCUT_MODE_FIRST_SUBPAGE,
'title' => 'Spacer page',
]);
$this->insertArray('pages', [
'uid' => 9,
'pid' => 8,
'doktype' => PageRepository::DOKTYPE_DEFAULT,
'title' => 'Spacer nested page',
]);

$this->indexingService->resetIndex();
$this->indexingService->indexFull('foo_pages');

$this->assertDocumentInIndex(3);
$this->assertDocumentNotInIndex(4);
$this->assertDocumentInIndex(5);
$this->assertDocumentNotInIndex(6);
$this->assertDocumentInIndex(7);
$this->assertDocumentNotInIndex(8);
$this->assertDocumentInIndex(9);
}

/**
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/DataCollector/PagesDataCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function getPagesDataCollector($pid = 0)
'pid' => $pid,
'sysLanguageOverlay' => 1,
'doktypes' => ['1'],
'transientDoktypes' => ['4', '199'],
'transientDoktypes' => ['3', '4', '199'],
'groupWhereClause' => ' AND (pages.fe_group = "" OR pages.fe_group = 0)',
'includeHideInMenu' => false,
'mode' => 'whitelist',
Expand Down
2 changes: 1 addition & 1 deletion doc/configuration/data-collector.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ These settings are specific for the PagesDataCollector. The PagesDataCollector h
|----------|---------|----------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| pid | integer | yes | Default: *0* | The pid to start the recursive fetching from. Since the PagesDataCollector fetches pages in a recursive tree structure, you should set the pid setting to your root page. |
| doktypes | string | yes | Default: *1* | Which doktypes to index. Default is 1 (normal pages). |
| transientDoktypes | string | yes | Default: *4,199* | Doktypes which should not be included in the index, but should be searched for valid subpages. Default is 4 (shortcuts) and 199 (spacers). |
| transientDoktypes | string | yes | Default: *3,4,199* | Doktypes which should not be included in the index, but should be searched for valid subpages. Default is 3 (links), 4 (shortcuts) and 199 (spacers). |
| groupWhereClause | string | yes | Default: *AND (pages.fe\_group = "" OR pages.fe\_group = 0)* | The where clause applied for fe_group restrictions. By default all pages with access settings are hidden. You can add *" OR pages.fe\_group = -1"* if you want to show pages which are visible for non-authenticated users. |
| includeHideInMenu | boolean | yes | Default: *false* | Whether to include pages that are hidden in menu (`nav\_hide` field). |

Expand Down