36 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'fal'][
'registeredCollections'] as $type => $class) {
52 if (strlen($type) > 30) {
53 throw new \InvalidArgumentException(
'FileCollection type can have a max string length of 30 bytes', 1391295611);
56 if (!class_exists($className)) {
57 throw new \InvalidArgumentException(
'Class ' . $className .
' does not exist.', 1391295613);
60 if (!in_array(AbstractFileCollection::class, class_parents($className),
true)) {
61 throw new \InvalidArgumentException(
'FileCollection ' . $className .
' needs to extend the AbstractFileCollection.', 1391295633);
64 if (isset($this->types[$type])) {
66 if ($this->types[$type] === $className) {
70 throw new \InvalidArgumentException(
'FileCollections ' . $type .
' is already registered.', 1391295643);
74 $this->types[$type] = $className;
87 public function addTypeToTCA($type, $label, $availableFields, array $additionalColumns = [])
89 $GLOBALS[
'TCA'][
'sys_file_collection'][
'types'][$type] = [
90 'showitem' =>
'sys_language_uid, l10n_parent, l10n_diffsource, title, --palette--;;1, type, ' . $availableFields
95 foreach (
$GLOBALS[
'TCA'][
'sys_file_collection'][
'columns'][
'type'][
'config'][
'items'] as $key => $item) {
96 if ($item[1] === $type) {
98 $GLOBALS[
'TCA'][
'sys_file_collection'][
'columns'][
'type'][
'config'][
'items'][$key][0] = $label;
102 $GLOBALS[
'TCA'][
'sys_file_collection'][
'columns'][
'type'][
'config'][
'items'][] = [
107 if ($additionalColumns !== []) {
110 return $GLOBALS[
'TCA'][
'sys_file_collection'];
122 if (!isset($this->types[$type])) {
123 throw new \InvalidArgumentException(
'Desired FileCollection type "' . $type .
'" is not in the list of available FileCollections.', 1391295644);
125 return $this->types[$type];
136 return isset($this->types[$type]);