2
votes

I want to jump to a specific record in the TYPO3 backend via JavaScript. I got a modal and a "jump" button that should take a PID and a record UID and jump to the records edit view. I know this works with PHP, but is there an API in the FormEngine or somewhere else in the TYPO3 backend JS Framework that can do this? I discovered top.getModuleUrl and top.loadEditId but the first one will jump to a module - which I don't know if the edit view is - or jump to the edit view of a page, not a record. So what I am trying to do in code would be the following:

var $modal = Modal.confirm( noteRecord.subject , noteRecord.message, Severity.info, [
    {
        text: TYPO3.lang['sys_note.dismiss'] || 'Dismiss',
        active: true,
        btnClass: 'btn-error',
        name: 'dismiss'
    },
    {
        text: TYPO3.lang['sys_note.showRecord'] || 'Go to record',
        btnClass: 'btn-warning',
        name: 'goto'
    }
]);
$modal.on('button.clicked', function(e) {
    if ( e.target.name === 'dismiss' ) {
        Modal.dismiss();
    } else if ( e.target.name === 'goto' ) {
        Modal.dismiss();
        /*
         * At this point, the noteRecord contains a pid and a uid we want to 
         * call somehow
         */
        // something like: TYPO3.callRecordEditModule(noteRecord.pid, noteRecord.uid);
    }
});
1

1 Answers

4
votes

In PHP I create the edit URL the following way:

<?php
$url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(
    'record_edit',
    array(
        'edit[' . $table . '][' . $uid . ']' => 'edit',
        'returnUrl' => \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')
    )
);