[TASK] Replace icon by IconFactory: status-status-current
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Tree / View / ContentLayoutPagePositionMap.php
1 <?php
2 namespace TYPO3\CMS\Backend\Tree\View;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Imaging\Icon;
18 use TYPO3\CMS\Core\Imaging\IconFactory;
19 use TYPO3\CMS\Core\Utility\GeneralUtility;
20
21 /**
22 * Position map class for content elements within the page module
23 */
24 class ContentLayoutPagePositionMap extends PagePositionMap {
25
26 /**
27 * @var bool
28 */
29 public $dontPrintPageInsertIcons = 1;
30
31 /**
32 * @var string
33 */
34 public $l_insertNewRecordHere = 'newContentElement';
35
36 /**
37 * Wrapping the title of the record.
38 *
39 * @param string $str The title value.
40 * @param array $row The record row.
41 * @return string Wrapped title string.
42 */
43 public function wrapRecordTitle($str, $row) {
44 $aOnClick = 'jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('tt_content:' . $row['uid'])))) . ');return false;';
45 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $str . '</a>';
46 }
47
48 /**
49 * Wrapping the column header
50 *
51 * @param string $str Header value
52 * @param string $vv Column info.
53 * @return string
54 * @see printRecordMap()
55 */
56 public function wrapColumnHeader($str, $vv) {
57 $aOnClick = 'jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('_EDIT_COL:' . $vv)))) . ');return false;';
58 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $str . '</a>';
59 }
60
61 /**
62 * Create on-click event value.
63 *
64 * @param array $row The record.
65 * @param string $vv Column position value.
66 * @param int $moveUid Move uid
67 * @param int $pid PID value.
68 * @param int $sys_lang System language
69 * @return string
70 */
71 public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0) {
72 if (is_array($row)) {
73 $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/-' . $row['uid'] . '/' . $row['colPos']));
74 } else {
75 $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/' . $pid . '/' . $vv));
76 }
77 return 'jumpToUrl(' . GeneralUtility::quoteJSvalue($location) . ');return false;';
78 }
79
80 /**
81 * Wrapping the record header (from getRecordHeader())
82 *
83 * @param string $str HTML content
84 * @param array $row Record array.
85 * @return string HTML content
86 */
87 public function wrapRecordHeader($str, $row) {
88 if ($row['uid'] == $this->moveUid) {
89 /** @var IconFactory $iconFactory */
90 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
91 return $iconFactory->getIcon('status-status-current', Icon::SIZE_SMALL)->render() . $str;
92 } else {
93 return $str;
94 }
95 }
96 }