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

[FEATURE] Add switch for default-state of tx_sluggi_sync for new pages #74

Open
wants to merge 1 commit into
base: typo3-10
Choose a base branch
from
Open
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
11 changes: 10 additions & 1 deletion Classes/Backend/Hook/DataHandlerSlugUpdateHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ public function processDatamap_preProcessFieldArray(
$id,
DataHandler $dataHandler
): void {
if (
'pages' === $table && !MathUtility::canBeInterpretedAsInteger($id)){
//new page was created
$synchronizeOn = (bool) Configuration::get('synchronize_on');
if ($synchronizeOn){
$incomingFieldArray['tx_sluggi_sync'] = 1;
}
return;
}
if (
'pages' !== $table
// This is set in \TYPO3\CMS\Backend\History\RecordHistoryRollback::performRollback,
Expand Down Expand Up @@ -185,4 +194,4 @@ protected function isNestedHookInvocation(DataHandler $dataHandler): bool

return in_array(\TYPO3\CMS\Redirects\Service\SlugService::CORRELATION_ID_IDENTIFIER, $correlationIdAspects, true);
}
}
}
2 changes: 1 addition & 1 deletion Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function array_flatten($array): array {
'labelUnchecked' => 'LLL:EXT:sluggi/Resources/Private/Language/locallang.xlf:pages.tx_sluggi_sync.disabled'
]
],
'default' => 1
'default' => 0
]
]
];
Expand Down
2 changes: 2 additions & 0 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ slash_replacement = 1
pages_fields = [["nav_title","title"]]
# cat=basic; type=boolean; label=Enable synchronization of slug segment with configured page fields
synchronize = 1
# cat=basic; type=boolean; label=Turn on synchronization of slug segment with configured page fields
synchronize_on = 0
# cat=basic; type=boolean; label=Allow standard editors only editing of the last segment of the URL (single page)
last_segment_only = 0
2 changes: 1 addition & 1 deletion ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#
CREATE TABLE pages (
tx_sluggi_lock SMALLINT(5) UNSIGNED DEFAULT '0' NOT NULL,
tx_sluggi_sync SMALLINT(5) UNSIGNED DEFAULT '1' NOT NULL
tx_sluggi_sync SMALLINT(5) UNSIGNED DEFAULT '0' NOT NULL
);