Classes/TcaDataGenerator/Generator.php
public function create()
    {
        // Add entry page on top level
        $newIdOfEntryPage = StringUtility::getUniqueId('NEW');
        $data = [
            'pages' => [
                $newIdOfEntryPage => [
                    'title' => 'styleguide TCA demo',
                    'pid' => 0 - $this->getUidOfLastTopLevelPage(),
                    // Mark this page as entry point
                    'tx_styleguide_containsdemo' => 'tx_styleguide',
                    // Have the "globus" icon for this page
                    'is_siteroot' => 1,
                ],
            ],
        ];

        // Add rows of third party tables like be_users and fal records
        $this->populateRowsOfThirdPartyTables();

        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $sysLanguageStyleguideDemoUids = $recordFinder->findUidsOfDemoLanguages();

        // Add a page for each main table below entry page
        $mainTables = $this->getListOfStyleguideMainTables();
        // Have the first main table inside entry page
        $neighborPage = $newIdOfEntryPage;
        foreach ($mainTables as $mainTable) {
            $newIdOfPage = StringUtility::getUniqueId('NEW');
            $data['pages'][$newIdOfPage] = [
                'title' => str_replace('_', ' ', substr($mainTable, strlen('tx_styleguide_'))),
                'tx_styleguide_containsdemo' => $mainTable,
                'hidden' => 0,
                'pid' => $neighborPage,
            ];

            if (!empty($sysLanguageStyleguideDemoUids)) {
                foreach ($sysLanguageStyleguideDemoUids as $languageUid) {
                    $newIdOfLocalizedPage = StringUtility::getUniqueId('NEW');
                    $data['pages'][$newIdOfLocalizedPage] = [
                        'title' => str_replace('_', ' ', substr($mainTable . " - language " . $languageUid, strlen('tx_styleguide_'))),
                        'tx_styleguide_containsdemo' => $mainTable,
                        'hidden' => 0,
                        'pid' => $neighborPage,
                        'sys_language_uid' => $languageUid,
                        'l10n_parent' => $newIdOfPage,
                        'l10n_source' => $newIdOfPage,
                    ];
                }
            }
            // Have next page after this page
            $neighborPage = '-' . $newIdOfPage;
        }

        // Populate page tree via DataHandler
        $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
        $dataHandler->start($data, []);
        $dataHandler->process_datamap();
        BackendUtility::setUpdateSignal('updatePageTree');

        // Create data for each main table
        foreach ($mainTables as $mainTable) {
            $generator = NULL;
            foreach ($this->tableHandler as $handlerName) {
                $generator = GeneralUtility::makeInstance($handlerName);
                if (!$generator instanceof TableHandlerInterface) {
                    throw new Exception(
                        'Table handler ' . $handlerName . ' must implement TableHandlerInterface',
                        1458302830
                    );
                }
                if ($generator->match($mainTable)) {
                    break;
                } else {
                    $generator = null;
                }
            }
            if (is_null($generator)) {
                throw new GeneratorNotFoundException(
                    'No table handler found',
                    1458302901
                );
            }
            $generator->handle($mainTable);
        }
    }
public function create()
    {
        // Add entry page on top level
        $newIdOfEntryPage = StringUtility::getUniqueId('NEW');
        $data = [
            'pages' => [
                $newIdOfEntryPage => [
                    'title' => 'styleguide TCA demo',
                    'pid' => 0 - $this->getUidOfLastTopLevelPage(),
                    // Mark this page as entry point
                    'tx_styleguide_containsdemo' => 'tx_styleguide',
                    // Have the "globus" icon for this page
                    'is_siteroot' => 1,
                ],
            ],
        ];

        // Add rows of third party tables like be_users and fal records
        $this->populateRowsOfThirdPartyTables();

        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $sysLanguageStyleguideDemoUids = $recordFinder->findUidsOfDemoLanguages();

        // Add a page for each main table below entry page
        $mainTables = $this->getListOfStyleguideMainTables();
        // Have the first main table inside entry page
        $neighborPage = $newIdOfEntryPage;
        foreach ($mainTables as $mainTable) {
            $newIdOfPage = StringUtility::getUniqueId('NEW');
            $data['pages'][$newIdOfPage] = [
                'title' => str_replace('_', ' ', substr($mainTable, strlen('tx_styleguide_'))),
                'tx_styleguide_containsdemo' => $mainTable,
                'hidden' => 0,
                'pid' => $neighborPage,
            ];

            if (!empty($sysLanguageStyleguideDemoUids)) {
                foreach ($sysLanguageStyleguideDemoUids as $languageUid) {
                    $newIdOfLocalizedPage = StringUtility::getUniqueId('NEW');
                    $data['pages'][$newIdOfLocalizedPage] = [
                        'title' => str_replace('_', ' ', substr($mainTable . " - language " . $languageUid, strlen('tx_styleguide_'))),
                        'tx_styleguide_containsdemo' => $mainTable,
                        'hidden' => 0,
                        'pid' => $neighborPage,
                        'sys_language_uid' => $languageUid,
                        'l10n_parent' => $newIdOfPage,
                        'l10n_source' => $newIdOfPage,
                    ];
                }
            }
            // Have next page after this page
            $neighborPage = '-' . $newIdOfPage;
        }

        // Populate page tree via DataHandler
        $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
        $dataHandler->start($data, []);
        $dataHandler->process_datamap();
        BackendUtility::setUpdateSignal('updatePageTree');

        // Create data for each main table
        foreach ($mainTables as $mainTable) {
            $generator = NULL;
            foreach ($this->tableHandler as $handlerName) {
                $generator = GeneralUtility::makeInstance($handlerName);
                if (!$generator instanceof TableHandlerInterface) {
                    throw new Exception(
                        'Table handler ' . $handlerName . ' must implement TableHandlerInterface',
                        1458302830
                    );
                }
                if ($generator->match($mainTable)) {
                    break;
                } else {
                    $generator = null;
                }
            }
            if (is_null($generator)) {
                throw new GeneratorNotFoundException(
                    'No table handler found',
                    1458302901
                );
            }
            $generator->handle($mainTable);
        }
    }
public function create ( ) { // Add entry page on top level $ newIdOfEntryPage = StringUtility :: getUniqueId ( 'NEW' ) ; $ data = [ 'pages' => [ $ newIdOfEntryPage => [ 'title' => 'styleguide TCA demo' , 'pid' => 0 - $ this -> getUidOfLastTopLevelPage ( ) , // Mark this page as entry point 'tx_styleguide_containsdemo' => 'tx_styleguide' , // Have the "globus" icon for this page 'is_siteroot' => 1 , ] , ] , ] ; // Add rows of third party tables like be_users and fal records $ this -> populateRowsOfThirdPartyTables ( ) ; $ recordFinder = GeneralUtility :: makeInstance ( RecordFinder :: class ) ; $ sysLanguageStyleguideDemoUids = $ recordFinder -> findUidsOfDemoLanguages ( ) ; // Add a page for each main table below entry page $ mainTables = $ this -> getListOfStyleguideMainTables ( ) ; // Have the first main table inside entry page $ neighborPage = $ newIdOfEntryPage ; foreach ( $ mainTables as $ mainTable ) { $ newIdOfPage = StringUtility :: getUniqueId ( 'NEW' ) ; $ data [ 'pages' ] [ $ newIdOfPage ] = [ 'title' => str_replace ( '_' , ' ' , substr ( $ mainTable , strlen ( 'tx_styleguide_' ) ) ) , 'tx_styleguide_containsdemo' => $ mainTable , 'hidden' => 0 , 'pid' => $ neighborPage , ] ; if ( ! empty ( $ sysLanguageStyleguideDemoUids ) ) { foreach ( $ sysLanguageStyleguideDemoUids as $ languageUid ) { $ newIdOfLocalizedPage = StringUtility :: getUniqueId ( 'NEW' ) ; $ data [ 'pages' ] [ $ newIdOfLocalizedPage ] = [ 'title' => str_replace ( '_' , ' ' , substr ( $ mainTable . " - language " . $ languageUid , strlen ( 'tx_styleguide_' ) ) ) , 'tx_styleguide_containsdemo' => $ mainTable , 'hidden' => 0 , 'pid' => $ neighborPage , 'sys_language_uid' => $ languageUid , 'l10n_parent' => $ newIdOfPage , 'l10n_source' => $ newIdOfPage , ] ; } } // Have next page after this page $ neighborPage = '-' . $ newIdOfPage ; } // Populate page tree via DataHandler $ dataHandler = GeneralUtility :: makeInstance ( DataHandler :: class ) ; $ dataHandler -> start ( $ data , [ ] ) ; $ dataHandler -> process_datamap ( ) ; BackendUtility :: setUpdateSignal ( 'updatePageTree' ) ; // Create data for each main table foreach ( $ mainTables as $ mainTable ) { $ generator = NULL ; foreach ( $ this -> tableHandler as $ handlerName ) { $ generator = GeneralUtility :: makeInstance ( $ handlerName ) ; if ( ! $ generator instanceof TableHandlerInterface ) { throw new Exception ( 'Table handler ' . $ handlerName . ' must implement TableHandlerInterface' , 1458302830 ) ; } if ( $ generator -> match ( $ mainTable ) ) { break ; } else { $ generator = null ; } } if ( is_null ( $ generator ) ) { throw new GeneratorNotFoundException ( 'No table handler found' , 1458302901 ) ; } $ generator -> handle ( $ mainTable ) ; } }
Create a page tree for styleguide records and add records on them.

@throws Exception
@throws GeneratorNotFoundException
Create a page tree for styleguide records and add records on them .