-
Notifications
You must be signed in to change notification settings - Fork 639
/
PageMovingPagePositionMap.php
79 lines (72 loc) · 2.3 KB
/
PageMovingPagePositionMap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace TYPO3\CMS\Backend\Tree\View;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Position map class for moving pages,
* previously resided in typo3/move_el.php
*/
class PageMovingPagePositionMap extends PagePositionMap
{
/**
* @var string
*/
public $l_insertNewPageHere = 'movePageToHere';
/**
* Page tree implementation class name
*
* @var string
*/
protected $pageTreeClassName = PageTreeView::class;
/**
* Creates the onclick event for the insert-icons.
*
* @param int $pid The pid.
* @param int $newPagePID New page id.
* @return string Onclick attribute content
*/
public function onClickEvent($pid, $newPagePID)
{
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
return 'window.location.href=' . GeneralUtility::quoteJSvalue((string)$uriBuilder->buildUriFromRoute('tce_db', [
'cmd[pages][' . $this->moveUid . '][' . $this->moveOrCopy . ']' => $pid,
'redirect' => $this->R_URI,
])) . ';return false;';
}
/**
* Wrapping page title.
*
* @param string $str Page title.
* @param array $rec Page record (?)
* @return string Wrapped title.
*/
public function linkPageTitle($str, $rec)
{
$url = GeneralUtility::linkThisScript(['uid' => (int)$rec['uid'], 'moveUid' => $this->moveUid]);
return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
}
/**
* Wrap $t_code in bold IF the $dat uid matches $id
*
* @param string $t_code Title string
* @param array $dat Information array with record array inside.
* @param int $id The current id.
* @return string The title string.
*/
public function boldTitle($t_code, $dat, $id)
{
return parent::boldTitle($t_code, $dat, $this->moveUid);
}
}