2 namespace TYPO3\CMS\Core\Imaging;
45 'hidden' =>
'overlay-hidden',
46 'fe_group' =>
'overlay-restricted',
47 'starttime' =>
'overlay-scheduled',
48 'endtime' =>
'overlay-scheduled',
49 'futureendtime' =>
'overlay-scheduled',
50 'readonly' =>
'overlay-readonly',
51 'deleted' =>
'overlay-deleted',
52 'missing' =>
'overlay-missing',
53 'translated' =>
'overlay-translated',
54 'protectedSection' =>
'overlay-includes-subpages'
89 $requestedIcon = json_decode(
90 isset($parsedBody[
'icon'])
92 : $queryParams[
'icon'],
96 list($identifier, $size, $overlayIdentifier, $iconState) = $requestedIcon;
97 if (empty($overlayIdentifier)) {
98 $overlayIdentifier = null;
102 $this->getIcon($identifier, $size, $overlayIdentifier, $iconState)->render()
104 $response = $response->
withHeader(
'Content-Type',
'text/html; charset=utf-8');
117 if ($this->iconRegistry->isDeprecated($identifier)) {
118 $deprecationSettings = $this->iconRegistry->getDeprecationSettings($identifier);
120 if (!empty($deprecationSettings[
'replacement'])) {
121 $identifier = $deprecationSettings[
'replacement'];
124 if (!$this->iconRegistry->isRegistered($identifier)) {
125 $identifier = $this->iconRegistry->getDefaultIconIdentifier();
128 $iconConfiguration = $this->iconRegistry->getIconConfigurationByIdentifier($identifier);
129 $iconConfiguration[
'state'] = $state;
130 $icon = $this->
createIcon($identifier, $size, $overlayIdentifier, $iconConfiguration);
134 $iconProvider->prepareIconMarkup($icon, $iconConfiguration[
'options']);
151 if (empty($overlayIdentifier)) {
152 $overlayIdentifier = null;
154 return $this->getIcon($iconIdentifier, $size, $overlayIdentifier);
175 $recordType = array();
178 if (isset(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_column'])) {
179 $column =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_column'];
180 if (isset($row[$column])) {
184 if (is_array($row[$column])) {
185 $recordType[1] = implode(
',', $row[$column]);
187 $recordType[1] = $row[$column];
190 $recordType[1] =
'default';
195 if ($table ===
'pages') {
196 if ((
int)$row[
'nav_hide'] > 0) {
197 $recordType[2] = $recordType[1] .
'-hideinmenu';
199 if ((
int)$row[
'is_siteroot'] > 0) {
200 $recordType[3] = $recordType[1] .
'-root';
202 if (!empty($row[
'module'])) {
203 $recordType[4] =
'contains-' . $row[
'module'];
205 if ((
int)$row[
'content_from_pid'] > 0) {
206 if ($row[
'is_siteroot']) {
207 $recordType[4] =
'page-contentFromPid-root';
209 $recordType[4] = (int)$row[
'nav_hide'] === 0 ?
'page-contentFromPid' :
'page-contentFromPid-hideinmenu';
213 if (is_array(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'])) {
214 foreach ($recordType as $key => $type) {
215 if (isset(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'][$type])) {
216 $recordType[$key] =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'][$type];
218 unset($recordType[$key]);
221 $recordType[0] =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'][
'default'];
222 if (isset(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'][
'mask'])) {
223 $recordType[5] = str_replace(
'###TYPE###', $row[$column],
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'][
'mask']);
225 if (isset(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'][
'userFunc'])) {
226 $parameters = array(
'row' => $row);
230 foreach ($recordType as &$type) {
231 $type =
'tcarecords-' . $table .
'-' . $type;
234 $recordType[0] =
'tcarecords-' . $table .
'-default';
236 }
elseif (is_array(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'])) {
237 $recordType[0] =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_classes'][
'default'];
239 $recordType[0] =
'tcarecords-' . $table .
'-default';
243 foreach ($recordType as $iconName) {
244 if ($this->iconRegistry->isRegistered($iconName)) {
249 return $this->iconRegistry->getDefaultIconIdentifier();
263 $tcaCtrl =
$GLOBALS[
'TCA'][$table][
'ctrl'];
267 'starttime' =>
false,
269 'futureendtime' =>
false,
272 'protectedSection' =>
false,
273 'nav_hide' => (
bool)$row[
'nav_hide']
276 if (is_array($tcaCtrl[
'enablecolumns'])) {
277 $enableColumns = $tcaCtrl[
'enablecolumns'];
279 if (isset($enableColumns[
'disabled']) && !empty($row[$enableColumns[
'disabled']])) {
280 $status[
'hidden'] =
true;
283 if (!empty($enableColumns[
'starttime']) &&
$GLOBALS[
'EXEC_TIME'] < (
int)$row[$enableColumns[
'starttime']]) {
284 $status[
'starttime'] =
true;
287 if (!empty($enableColumns[
'endtime'])) {
288 if ((
int)$row[$enableColumns[
'endtime']] > 0) {
289 if ((
int)$row[$enableColumns[
'endtime']] <
$GLOBALS[
'EXEC_TIME']) {
291 $status[
'endtime'] =
true;
294 $status[
'futureendtime'] =
true;
299 if (!empty($enableColumns[
'fe_group']) && $row[$enableColumns[
'fe_group']]) {
300 $status[
'fe_group'] =
true;
304 if (isset($tcaCtrl[
'delete']) && !empty($row[$tcaCtrl[
'delete']])) {
305 $status[
'deleted'] =
true;
308 if ($table ===
'pages' && (
int)$row[
'extendToSubpages'] > 0) {
309 $status[
'protectedSection'] =
true;
312 $status[
'deleted'] =
true;
317 foreach ($this->overlayPriorities as $priority) {
318 if ($status[$priority]) {
319 $iconName = $this->recordStatusMapping[$priority];
337 $iconName = $this->iconRegistry->getIconIdentifierForFileExtension($fileExtension);
338 return $this->getIcon($iconName, $size, $overlayIdentifier);
361 $iconIdentifier = null;
366 if ($resource->
getStorage()->isBrowsable() ===
false && !empty($options[
'mount-root'])) {
367 $iconIdentifier =
'apps-filetree-folder-locked';
371 $iconIdentifier =
'apps-filetree-root';
374 $role = is_callable([$resource,
'getRole']) ? $resource->getRole() :
'';
377 if (!empty($options[
'mount-root'])) {
378 $iconIdentifier =
'apps-filetree-mount';
380 $overlayIdentifier =
'overlay-locked';
382 $overlayIdentifier =
'overlay-restricted';
386 if ($iconIdentifier === null) {
388 if (!empty($options[
'folder-open'])) {
389 $iconIdentifier =
'apps-filetree-folder-opened';
391 $iconIdentifier =
'apps-filetree-folder-default';
395 $iconIdentifier =
'apps-filetree-folder-temp';
397 $iconIdentifier =
'apps-filetree-folder-recycler';
404 !$resource->
getStorage()->checkFolderActionPermission(
'add', $resource)
406 $overlayIdentifier =
'overlay-locked';
412 $mimeTypeIcon = $this->iconRegistry->getIconIdentifierForMimeType($resource->getMimeType());
415 if ($mimeTypeIcon !== null) {
416 $iconIdentifier = $mimeTypeIcon;
418 $fileExtensionIcon = $this->iconRegistry->getIconIdentifierForFileExtension($resource->getExtension());
419 if ($fileExtensionIcon !==
'mimetypes-other-other') {
421 $iconIdentifier = $fileExtensionIcon;
424 $mimeTypeParts = explode(
'/', $resource->getMimeType());
425 $mimeTypeIcon = $this->iconRegistry->getIconIdentifierForMimeType($mimeTypeParts[0] .
'/*');
426 if ($mimeTypeIcon !== null) {
427 $iconIdentifier = $mimeTypeIcon;
430 $iconIdentifier = $fileExtensionIcon;
434 if ($resource->isMissing()) {
435 $overlayIdentifier =
'overlay-missing';
439 unset($options[
'mount-root']);
440 unset($options[
'folder-open']);
441 list($iconIdentifier, $overlayIdentifier) = $this->
emitBuildIconForResourceSignal($resource, $size, $options, $iconIdentifier, $overlayIdentifier);
442 return $this->getIcon($iconIdentifier, $size, $overlayIdentifier);
454 protected function createIcon($identifier, $size, $overlayIdentifier = null, array $iconConfiguration)
457 $icon->setIdentifier($identifier);
458 $icon->setSize($size);
459 $icon->setState($iconConfiguration[
'state'] ?:
new IconState());
460 if ($overlayIdentifier !== null) {
463 if (!empty($iconConfiguration[
'options'][
'spinning'])) {
464 $icon->setSpinning(
true);
484 $result = $this->
getSignalSlotDispatcher()->dispatch(IconFactory::class,
'buildIconForResourceSignal', array($resource, $size, $options, $iconIdentifier, $overlayIdentifier));
485 $iconIdentifier = $result[3];
486 $overlayIdentifier = $result[4];
487 return array($iconIdentifier, $overlayIdentifier);