Skip to content

Commit

Permalink
Do not force-publish folderpage
Browse files Browse the repository at this point in the history
fixes #18
  • Loading branch information
aschempp committed Mar 31, 2021
1 parent a706b66 commit 7746cf5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
17 changes: 0 additions & 17 deletions src/DataContainer/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,6 @@ public function onSaveType($value, $dc)
return $value;
}

/**
* A folder page can never be unpublished.
*
* @param string $value
* @param \Contao\DataContainer $dc
*
* @return string
*/
public function onSavePublished($value, $dc)
{
if (null !== $dc->activeRecord && 'folder' === $dc->activeRecord->type) {
return '1';
}

return $value;
}

/**
* Clean up all folder page aliases (as they might contain something).
*
Expand Down
1 change: 0 additions & 1 deletion src/Resources/contao/dca/tl_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

$GLOBALS['TL_DCA']['tl_page']['fields']['type']['options_callback'][0] = 'terminal42_folderpage.datacontainer.page';

$GLOBALS['TL_DCA']['tl_page']['fields']['published']['save_callback'][] = ['terminal42_folderpage.datacontainer.page', 'onSavePublished'];
$GLOBALS['TL_DCA']['tl_page']['fields']['alias']['save_callback'][] = ['terminal42_folderpage.datacontainer.page', 'adjustAlias'];
array_unshift($GLOBALS['TL_DCA']['tl_page']['fields']['alias']['save_callback'], ['terminal42_folderpage.datacontainer.page', 'emptyFolderAliases']);

Expand Down

0 comments on commit 7746cf5

Please sign in to comment.