Commit 2cb41db2 authored by Michael Oehlhof's avatar Michael Oehlhof Committed by Frans Saris
Browse files

[FEATURE] Page module: Show notice "Content is also shown on:"

If a page is selected in page module which content is also shown on
other pages, now a notice is shown with the titles and pid of these pages.

Resolves: #69572
Releases: master
Change-Id: Ie66564da98160825f5759c6ac4937fbbeaafdce0

Tested-by: default avatarTYPO3com <>
Tested-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <>
Reviewed-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <>
Reviewed-by: Frans Saris's avatarFrans Saris <>
Tested-by: Frans Saris's avatarFrans Saris <>
parent f9d17958
......@@ -644,10 +644,50 @@ class PageLayoutController
'state' => InfoboxViewHelper::STATE_INFO
$content .= $view->render();
} else {
$links = $this->getPageLinksWhereContentIsAlsoShownOn($this->pageinfo['uid']);
if (!empty($links)) {
$message = sprintf($lang->getLL('content_on_pid_title'), $links);
'title' => '',
'message' => $message,
'state' => InfoboxViewHelper::STATE_INFO
$content .= $view->render();
return $content;
* Get all pages with links where the content of a page $pageId is also shown on
* @param int $pageId
* @return string
protected function getPageLinksWhereContentIsAlsoShownOn($pageId)
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
->where($queryBuilder->expr()->eq('content_from_pid', $queryBuilder->createNamedParameter($pageId, \PDO::PARAM_INT)));
$links = [];
$rows = $queryBuilder->execute()->fetchAll();
if (!empty($rows)) {
foreach ($rows as $row) {
$linkToPid = $this->local_linkThisScript(['id' => $row['uid']]);
$title = BackendUtility::getRecordTitle('pages', $row);
$link = '<a href="' . htmlspecialchars($linkToPid) . '">' . htmlspecialchars($title) . ' (PID ' . (int)$row['uid'] . ')</a>';
$links[] = $link;
return implode(', ', $links);
* @return string $title
......@@ -282,6 +282,9 @@
<trans-unit id="content_from_pid_title">
<source>Page uses content from this page: %s</source>
<trans-unit id="content_on_pid_title">
<source>This content is also shown on: %s</source>
<trans-unit id="pageIsExternalLinkMessage">
<source>Page is a link to the following external URL: %s</source>
.. include:: ../../Includes.txt
Feature: #69572 - Page module Notice "Content is also shown on:"
See :issue:`69572`
When page content is inherited from different page via "Show content from page" there is a notice displayed on the page.
This feature does the opposite and displays a notice on pages that are inherited elsewhere:
"This content is also shown on:"
On pages that are inherited elsewhere you see a notice with links to the pages where the content is inherited.
.. index:: Backend
\ No newline at end of file
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