Skip to content
Snippets Groups Projects
Commit 5fc1eab8 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Retrieving siteroot

parent 54c1b8ac
No related branches found
No related tags found
1 merge request!2Feature multiclient
......@@ -80,6 +80,8 @@ class MailController extends ActionController {
$selectedTemplate = NULL, $selectedExtension = NULL, $selectedLanguageLeft = NULL,
$selectedLanguageRight = NULL, $selectedExtensionKey = NULL, $selectedTemplateKey = NULL
) {
$siteRoot = BackendService::getSiteRoot((int) GeneralUtility::_GP('id'));
if (!($this->session instanceof PhpSession)) {
$this->session = $this->objectManager->get('SGalinski\SgMail\Session\PhpSession');
$this->session->setSessionKey('sg_mail_controller_session');
......
......@@ -94,4 +94,23 @@ class BackendService {
$buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
$docHeaderComponent->getButtonBar();
}
/**
* Retrieves the next site root in the page hierarchy from the current page
*
* @param $currentPid
* @return array
*/
public static function getSiteRoot($currentPid) {
$rootLine = BackendUtility::BEgetRootLine((int) GeneralUtility::_GP('id'));
$siteRoot = [];
foreach ($rootLine as $page) {
if ($page['is_siteroot'] === '1') {
$siteRoot = $page;
break;
}
}
return $siteRoot;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment