User Experience would be best if we provide a readonly checkbox, probably followed by another (passthrough) field that gives a short explanation about the reason why the checkbox is disabled (there are files in this storage, so you can't change configuration).
We basically have two possible solutions:
- we render the field by userFunc, basically like in \TYPO3\CMS\Core\Resource\Service\UserStorageCapabilityService
- we implement a new tca field config option, that allows to mark and render a field as disable depending of a userFunc
I personally prefer the second option, so that we implement the new tca field config option that is quite similar to displayCond, but instead of hiding the field it only renders it with disabled attribute.
Basically it's the same functionality like its implemented for fields with l10n_config defaultAsReadonly \TYPO3\CMS\Backend\Form\FormEngine (line 1156 ff) - set ['config']['readOnly'] = TRUE, but dependent on the result of a userFunc.
The name of the option has to be discussed, a possible solution could be to taken the config option readOnly and allow a path, class- and method-name in it, or to define a new config option like readOnlyUserCond. This method should return TRUE or FALSE.
TCA config options could look like this:
'case_sensitive' => array(
'exclude' => 0,
'label' => 'LLL:EXT:lang/locallang_mod_file_list.xlf:localDriverFlexform_caseSensitive',
'config' => array(
'type' => 'check',
'default' => 1,
'readOnly' => 'typo3/sysext/core/Classes/Resource/Service/UserStorageCapabilityService.php:TYPO3\CMS\Core\Resource\Service\UserStorageCapabilityService->hasFiles'
)
),
or in flexform config, as we need it like this for this specific issue:
<caseSensitive>
<TCEforms>
<label>LLL:EXT:lang/locallang_mod_file_list.xlf:localDriverFlexform_caseSensitive</label>
<config>
<type>check</type>
<default>1</default>
<readOnly>typo3/sysext/core/Classes/Resource/Service/UserStorageCapabilityService.php:TYPO3\CMS\Core\Resource\Service\UserStorageCapabilityService->hasFiles</readOnly>
</config>
</TCEforms>
</caseSensitive>