[TYPO3-dev] Extbase BE module: Traverse copied page tree, fetch and update content elements and page properties

pcworld 0188801 at googlemail.com
Wed Aug 27 19:32:56 CEST 2014


Hello,

I'm writing a TYPO3 6.2 Extbase extension (backend module) that
recursively copies a selected page tree. The content elements of the
chosen pages contain placeholder strings in bodytext, captions, alt
tags, page keywords etc. In the copy of the original page tree the
keywords ought to be replaced by user-chosen strings.

Copying a page tree was solved with this code:

$cmdmap = array(
	'pages' => array(
		$srcPid => array(
			'copy' => $destPid,
		),
	),
);
$tce = 
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_TCEmain');
$tce->copyTree = 99999;
$tce->start(false, $cmdmap);
$tce->process_cmdmap();

Next step in implementation is to traverse the copied page tree and
update content elements, page properties etc.
For that I need to
- find out the PID that resulted from the copy process in process_cmdmap
- traverse the copied page tree (maybe something like pi_getPidList for
   Extbase backend modules?)
- and for each page:
     - get page properties and update them
     - traverse content elements, get their bodytext and other properties
       and update them.

Which APIs are suited for these tasks?
I see that TCEmain can be used to update columns, but how do I get the
current values? (The extension will perform string manipulations on
them.) Is there any API that returns the same data structure that can be
used with process_datamap?

Thanks for any hints in the right direction. If you have any code
snippets/examples, they would be appreciated.



More information about the TYPO3-dev mailing list