‪TYPO3CMS  ‪main
TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook Class Reference

Public Member Functions

 processDatamap_afterDatabaseOperations (string $status, string $table, $id, array $fieldArray, DataHandler $dataHandler)
 

Public Attributes

if($changeItem===null) $this persistedChangedItems [(int) $id] = $changeItem
 

Protected Member Functions

array< int, $persistedChangedItems;public __construct(protected SlugService $slugService, protected SlugRedirectChangeItemFactory $slugRedirectChangeItemFactory,) {} public function processDatamap_preProcessFieldArray(array $incomingFieldArray, string $table, $id, DataHandler $dataHandler):void { if($table !=='pages'||empty( $incomingFieldArray[ 'slug'])||$this->isNestedHookInvocation( $dataHandler)||!MathUtility::canBeInterpretedAsInteger( $id)||! $dataHandler->checkRecordUpdateAccess( $table, $id)) { return;} $changeItem=$this-> slugRedirectChangeItemFactory create ((int) $id)
 
 isNestedHookInvocation (DataHandler $dataHandler)
 

Detailed Description

This class is a specific TYPO3 hook implementation and is not part of the Public TYPO3 API.

Definition at line 29 of file DataHandlerSlugUpdateHook.php.

Member Function Documentation

◆ create()

array<int, $persistedChangedItems; public __construct( protected SlugService $slugService, protected SlugRedirectChangeItemFactory $slugRedirectChangeItemFactory, ) {} public function processDatamap_preProcessFieldArray(array $incomingFieldArray, string $table, $id, DataHandler $dataHandler): void { if ( $table !== 'pages' || empty($incomingFieldArray['slug']) || $this->isNestedHookInvocation($dataHandler) || !MathUtility::canBeInterpretedAsInteger($id) || !$dataHandler->checkRecordUpdateAccess($table, $id) ) { return; } $changeItem = $this-> slugRedirectChangeItemFactory TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook::create ( (int)  $id)
protected

Persisted slug values per record UID e.g. ‘[13 => SlugRedirectChangeItem( $original = ['slug’ => 'slug-a'] ), 14 => SlugRedirectChangeItem( $original = ['slug' => 'slug-x/example'] )`

SlugRedirectChangeItem>

◆ isNestedHookInvocation()

TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook::isNestedHookInvocation ( DataHandler  $dataHandler)
protected

Determines whether our identifier is part of correlation id aspects. In that case it would be a nested call which has to be ignored.

Definition at line 96 of file DataHandlerSlugUpdateHook.php.

References TYPO3\CMS\Redirects\Service\SlugService\CORRELATION_ID_IDENTIFIER, and TYPO3\CMS\Core\DataHandling\DataHandler\getCorrelationId().

Referenced by TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook\processDatamap_afterDatabaseOperations().

◆ processDatamap_afterDatabaseOperations()

TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook::processDatamap_afterDatabaseOperations ( string  $status,
string  $table,
  $id,
array  $fieldArray,
DataHandler  $dataHandler 
)

Acts on potential slug changes.

Hook processDatamap_afterDatabaseOperations is a record has been persisted and after DataHandler::fillInFields which ensure access to pages.slug field and applies possible evaluations (eval => 'trim,...).

Definition at line 73 of file DataHandlerSlugUpdateHook.php.

References TYPO3\CMS\Core\DataHandling\DataHandler\getCorrelationId(), TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook\isNestedHookInvocation(), and TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook\persistedChangedItems.

Member Data Documentation

◆ persistedChangedItems

if ( $changeItem===null) $this TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook::persistedChangedItems[(int) $id] = $changeItem