Navigation Menu

Skip to content

Commit

Permalink
[TASK] Remove content area from new record wizard
Browse files Browse the repository at this point in the history
The "Create new record" button reachable from the
List module receives a couple of patches to make
it easier to use.

As a first step, the "Create content element" part
is removed: Creating content elements from within
the list module typically leads to wrong colPos
selections, editors should manage content from
within the Page module only.

Resolves: #99660
Releases: main
Change-Id: I6ffa3bd5e0a48a97ad51e13d4bc9bfce8e187663
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77524
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
  • Loading branch information
froemken authored and sbuerk committed Jan 22, 2023
1 parent d5def3d commit e9ca54a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 40 deletions.
28 changes: 1 addition & 27 deletions typo3/sysext/backend/Classes/Controller/NewRecordController.php
Expand Up @@ -416,17 +416,7 @@ protected function renderNewRecordControls(): void
}
break;
case 'tt_content':
if (!$this->newContentInto || !$this->isRecordCreationAllowedForTable($table) || !$this->isTableAllowedOnPage($table, $this->pageinfo)) {
break;
}
$groupedLinksOnTop['tt_content'] = [
'title' => $lang->getLL('createNewContent'),
'icon' => 'actions-document-new',
'items' => [
$this->renderLink(htmlspecialchars($lang->sL($v['ctrl']['title'])), $table, $this->id),
$this->renderNewContentElementWizardLink(),
],
];
// Skip, as inserting content elements is part of the page module
break;
default:
if (!$this->newContentInto || !$this->isRecordCreationAllowedForTable($table) || !$this->isTableAllowedOnPage($table, $this->pageinfo)) {
Expand Down Expand Up @@ -570,22 +560,6 @@ protected function renderPageSelectPositionLink(): string
</a>';
}

/**
* Generate link to the new content element wizard
*/
protected function renderNewContentElementWizardLink(): string
{
$url = (string)$this->uriBuilder->buildUriFromRoute('new_content_element_wizard', ['id' => $this->id, 'returnUrl' => $this->returnUrl]);
$title = $this->getLanguageService()->getLL('newContentElement');
return '
<typo3-backend-new-content-element-wizard-button url="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($title) . '">
<button type="button" class="list-group-item list-group-item-action border-top-0">
' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . '
' . htmlspecialchars($this->getLanguageService()->getLL('clickForWizard')) . '
</button>
</typo3-backend-new-content-element-wizard-button>';
}

/**
* Returns TRUE if the tablename $checkTable is allowed to be created on the page with record $pid_row
*
Expand Down
@@ -0,0 +1,25 @@
.. include:: /Includes.rst.txt

.. _important-99660-1674251294:

==============================================================
Important: #99660 - Remove content area from new record wizard
==============================================================

See :issue:`99660`

Description
===========

The TYPO3 Backend comes with a distinction between "Content elements" and
other records: While content is managed using the specialized "Page" module,
the "List" module is the main management interface for other types of records.

Managing content elements from within the "List" module is not a good choice
for editors, the "Page" module should be used.

To foster this separation, the "Create new record" view reachable from within
the "List" module no longer allows to add "Content elements". As a side effect,
this avoids wrong or invalid default values of the "Column" (colPos) field.

.. index:: Backend, ext:backend
Expand Up @@ -195,12 +195,6 @@
<trans-unit id="createNewPage" resname="createNewPage">
<source>Create a new page</source>
</trans-unit>
<trans-unit id="createNewContent" resname="createNewContent">
<source>Create a new content element</source>
</trans-unit>
<trans-unit id="clickForWizard" resname="clickForWizard">
<source>Click here for wizard!</source>
</trans-unit>
<trans-unit id="insertNewPageHere" resname="insertNewPageHere">
<source>Insert the new page here</source>
</trans-unit>
Expand Down
Expand Up @@ -30,7 +30,7 @@ class RecyclerModuleCest
protected static string $treeNode = '#typo3-pagetree-tree .nodes .node';
protected static string $dragNode = '#typo3-pagetree-toolbar .svg-toolbar__drag-node';
protected static string $nodeEditInput = '.node-edit';
protected static string $contentTitle = 'Dummy Recycler Content';
protected static string $sysNoteSubject = 'Dummy Recycler Content';
protected static string $pageTitle = 'Dummy 1-styleguide TCA demo-new';

public function _before(ApplicationTester $I, PageTree $pageTree, ModalDialog $modalDialog): void
Expand All @@ -53,8 +53,8 @@ public function _before(ApplicationTester $I, PageTree $pageTree, ModalDialog $m
$I->switchToContentFrame();
$I->waitForElement('[title="Create new record"]');
$I->click('a[title="Create new record"]');
$I->click('//a[text()[normalize-space(.) = "Page Content"]]');
$I->fillField('//input[contains(@data-formengine-input-name, "data[tt_content]") and contains(@data-formengine-input-name, "[header]")]', static::$contentTitle);
$I->click('//a[text()[normalize-space(.) = "Internal note"]]');
$I->fillField('//input[contains(@data-formengine-input-name, "data[sys_note]") and contains(@data-formengine-input-name, "[subject]")]', static::$sysNoteSubject);
$I->click('button[name="_savedok"]');
$I->click('a[title="Close"]');
}
Expand All @@ -70,9 +70,9 @@ public function deleteAndRecoverRecords(ApplicationTester $I): void
// Select depth infinite
$I->selectOption('select[name="depth"]', 999);

$I->amGoingTo('See if the deleted page its content appear in the recycler');
$I->amGoingTo('See if the deleted page and its content appear in the recycler');
$I->waitForText(static::$pageTitle);
$I->waitForText(static::$contentTitle);
$I->waitForText(static::$sysNoteSubject);

$I->amGoingTo('Recover the page and its contents');
$I->click('tr[data-recordtitle="' . static::$pageTitle . '"] .t3js-multi-record-selection-check');
Expand All @@ -87,7 +87,7 @@ public function deleteAndRecoverRecords(ApplicationTester $I): void
$newPage = $this->pageTree->getPageXPathByPageName(static::$pageTitle);
$I->click($newPage);
$I->switchToContentFrame();
$I->waitForText(static::$contentTitle, 10, 'a[aria-label="Edit record"]');
$I->waitForText(static::$sysNoteSubject, 10, 'a[aria-label="Edit record"]');
}

/**
Expand Down Expand Up @@ -124,7 +124,7 @@ protected function deleteAndWipeRecords(ApplicationTester $I): void
$I->switchToContentFrame();
$I->click('[data-action="reload"]');

$I->cantSee(static::$contentTitle);
$I->cantSee(static::$sysNoteSubject);
$I->cantSee(static::$pageTitle);
}

Expand Down

0 comments on commit e9ca54a

Please sign in to comment.