[BUGFIX] Align Storage “is_public” checkbox with checkbox styles 15/55615/5
authorMathias Schreiber <mathias.schreiber@typo3.org>
Thu, 8 Feb 2018 19:27:18 +0000 (20:27 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 8 Feb 2018 22:45:08 +0000 (23:45 +0100)
The markup generated by the UserStorageCapabilityService is now
in line with the overall styling of checkboxes in TCA.

Resolves: #83810
Releases: master
Change-Id: I59bb480587bf30e054b855370e33e3d2dbfdfa91
Reviewed-on: https://review.typo3.org/55615
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Resource/Service/UserStorageCapabilityService.php

index 564350f..809b822 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Resource\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Imaging\Icon;
+use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
@@ -87,15 +89,23 @@ class UserStorageCapabilityService
      */
     protected function renderFileInformationContent(array $fileRecord, $isPublic)
     {
+        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
+        $iconChecked = $iconFactory->getIcon('actions-check', Icon::SIZE_SMALL)->render('inline');
+        $iconUnchecked = $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render('inline');
+
         $template = '
-               <div class="t3-form-field-item">
-                       <div class="checkbox">
-                               <label>
-                                       <input name="data[sys_file_storage][{uid}][is_public]" value="0" type="hidden">
-                                       <input class="checkbox" value="1" name="data[sys_file_storage][{uid}][is_public]_0" type="checkbox" %s>
-                               </label>
-                       </div>
-               </div>';
+        <div class="checkbox checkbox-type-icon-toggle">
+                <input type="checkbox" id="filestorage-ispublic" onclick="document.editform[\'data[sys_file_storage][{uid}][is_public]\'].value=this.checked?(document.editform[\'data[sys_file_storage][{uid}][is_public]\'].value|1):(document.editform[\'data[sys_file_storage][{uid}][is_public]\'].value&0);TBE_EDITOR.fieldChanged(\'sys_file_storage\',\'{uid}\',\'is_public\',\'data[sys_file_storage][{uid}][is_public]\');" class="checkbox-input" value="1" name="data[sys_file_storage][{uid}][is_public]_0" %s />
+                <label class="checkbox-label" for="filestorage-ispublic">
+                    <span class="checkbox-label-icon">
+                        <span class="checkbox-label-icon-checked">' . $iconChecked . '</span>
+                        <span class="checkbox-label-icon-unchecked">' . $iconUnchecked . '</span>
+                    </span>
+                    <span class="checkbox-label-text">&nbsp;</span>
+                </label>
+                <input type="hidden" name="data[sys_file_storage][{uid}][is_public]" value="1">
+            </div>
+        ';
 
         $content = sprintf(
             $template,