| @@ 2543-2571 (lines=29) @@ | ||
| 2540 | } |
|
| 2541 | } |
|
| 2542 | // If any languages are left, make selector: |
|
| 2543 | if (!empty($availableTranslations)) { |
|
| 2544 | $output = '<option value=""></option>'; |
|
| 2545 | foreach ($availableTranslations as $languageUid => $languageTitle) { |
|
| 2546 | // Build localize command URL to DataHandler (tce_db) |
|
| 2547 | // which redirects to FormEngine (record_edit) |
|
| 2548 | // which, when finished editing should return back to the current page (returnUrl) |
|
| 2549 | $parameters = [ |
|
| 2550 | 'justLocalized' => 'pages:' . $id . ':' . $languageUid, |
|
| 2551 | 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') |
|
| 2552 | ]; |
|
| 2553 | $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); |
|
| 2554 | $redirectUrl = (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters); |
|
| 2555 | $targetUrl = BackendUtility::getLinkToDataHandlerAction( |
|
| 2556 | '&cmd[pages][' . $id . '][localize]=' . $languageUid, |
|
| 2557 | $redirectUrl |
|
| 2558 | ); |
|
| 2559 | ||
| 2560 | $output .= '<option value="' . htmlspecialchars($targetUrl) . '">' . htmlspecialchars($languageTitle) . '</option>'; |
|
| 2561 | } |
|
| 2562 | ||
| 2563 | return '<div class="form-inline form-inline-spaced">' |
|
| 2564 | . '<div class="form-group">' |
|
| 2565 | . '<label for="createNewLanguage">' |
|
| 2566 | . htmlspecialchars($this->getLanguageService()->getLL('new_language')) |
|
| 2567 | . '</label>' |
|
| 2568 | . '<select class="form-control input-sm" name="createNewLanguage" onchange="window.location.href=this.options[this.selectedIndex].value">' |
|
| 2569 | . $output |
|
| 2570 | . '</select></div></div>'; |
|
| 2571 | } |
|
| 2572 | } |
|
| 2573 | return ''; |
|
| 2574 | } |
|
| @@ 710-736 (lines=27) @@ | ||
| 707 | } |
|
| 708 | } |
|
| 709 | // If any languages are left, make selector: |
|
| 710 | if (!empty($availableTranslations)) { |
|
| 711 | $output = '<option value="">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:new_language')) . '</option>'; |
|
| 712 | foreach ($availableTranslations as $languageUid => $languageTitle) { |
|
| 713 | // Build localize command URL to DataHandler (tce_db) |
|
| 714 | // which redirects to FormEngine (record_edit) |
|
| 715 | // which, when finished editing should return back to the current page (returnUrl) |
|
| 716 | $parameters = [ |
|
| 717 | 'justLocalized' => 'pages:' . $id . ':' . $languageUid, |
|
| 718 | 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') |
|
| 719 | ]; |
|
| 720 | /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */ |
|
| 721 | $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class); |
|
| 722 | $redirectUrl = (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters); |
|
| 723 | $targetUrl = BackendUtility::getLinkToDataHandlerAction( |
|
| 724 | '&cmd[pages][' . $id . '][localize]=' . $languageUid, |
|
| 725 | $redirectUrl |
|
| 726 | ); |
|
| 727 | ||
| 728 | $output .= '<option value="' . htmlspecialchars($targetUrl) . '">' . htmlspecialchars($languageTitle) . '</option>'; |
|
| 729 | } |
|
| 730 | ||
| 731 | return '<div class="form-inline form-inline-spaced">' |
|
| 732 | . '<div class="form-group">' |
|
| 733 | . '<select class="form-control input-sm" name="createNewLanguage" onchange="window.location.href=this.options[this.selectedIndex].value">' |
|
| 734 | . $output |
|
| 735 | . '</select></div></div>'; |
|
| 736 | } |
|
| 737 | } |
|
| 738 | return ''; |
|
| 739 | } |
|