2 namespace TYPO3\CMS\Core\Resource\Collection;
34 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'fal'][
'registeredCollections'] as $type => $class) {
50 if (strlen($type) > 30) {
51 throw new \InvalidArgumentException(
'FileCollection type can have a max string length of 30 bytes', 1391295611);
54 if (!class_exists($className)) {
55 throw new \InvalidArgumentException(
'Class ' . $className .
' does not exist.', 1391295613);
58 if (!in_array(\TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection::class, class_parents($className),
true)) {
59 throw new \InvalidArgumentException(
'FileCollection ' . $className .
' needs to extend the AbstractFileCollection.', 1391295633);
62 if (isset($this->types[$type])) {
64 if ($this->types[$type] === $className) {
67 throw new \InvalidArgumentException(
'FileCollections ' . $type .
' is already registered.', 1391295643);
71 $this->types[$type] = $className;
84 public function addTypeToTCA($type, $label, $availableFields, array $additionalColumns = array())
86 $GLOBALS[
'TCA'][
'sys_file_collection'][
'types'][$type] = array(
87 'showitem' =>
'sys_language_uid, l10n_parent, l10n_diffsource, title, --palette--;;1, type, ' . $availableFields
92 foreach (
$GLOBALS[
'TCA'][
'sys_file_collection'][
'columns'][
'type'][
'config'][
'items'] as $key => $item) {
93 if ($item[1] === $type) {
95 $GLOBALS[
'TCA'][
'sys_file_collection'][
'columns'][
'type'][
'config'][
'items'][$key][0] = $label;
99 $GLOBALS[
'TCA'][
'sys_file_collection'][
'columns'][
'type'][
'config'][
'items'][] = array(
104 if ($additionalColumns !== array()) {
105 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
$GLOBALS[
'TCA'][
'sys_file_collection'][
'columns'], $additionalColumns);
107 return $GLOBALS[
'TCA'][
'sys_file_collection'];
119 if (!isset($this->types[$type])) {
120 throw new \InvalidArgumentException(
'Desired FileCollection type "' . $type .
'" is not in the list of available FileCollections.', 1391295644);
122 return $this->types[$type];
133 return isset($this->types[$type]);