Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

FileTree with Images #5090

Closed
c4y opened this issue Dec 1, 2012 · 3 comments
Closed

FileTree with Images #5090

c4y opened this issue Dec 1, 2012 · 3 comments
Labels
Milestone

Comments

@c4y
Copy link

c4y commented Dec 1, 2012

The FileTree Widget shows images only on ContentElements with type "gallery". In my own ContentElements i want to see the images on multiSRC, too. To set this more dynamic, i suggest to set it in an array.

FileTree.php
Change Row 106 + 107 to

$this->blnIsGallery = (in_array($this->activeRecord->type, $GLOBALS['TL_GALLERIES']));
$this->blnIsDownloads = (in_array($this->activeRecord->type, $GLOBALS['TL_DOWNLOADS']));

In the config.php you can now set

$GLOBALS['TL_GALLERIES'][] = 'gallery';
$GLOBALS['TL_DOWNLOADS'][] = 'downloads';
@Serhii-DV
Copy link
Contributor

$this->blnIsGallery shouldn't depend on $this->activeRecord->type parameter. We should use something like isGallery setting in eval array. As proposed here #5164.

Also, related issue: #5133

@Serhii-DV
Copy link
Contributor

we just need to change code in FileTree.php widget, from:

$this->blnIsGallery = ($this->activeRecord->type == 'gallery');
$this->blnIsDownloads = ($this->activeRecord->type == 'downloads');

to:

$this->blnIsGallery = $this->isGallery || ($this->activeRecord->type == 'gallery');
$this->blnIsDownloads = $this->isDownloads || ($this->activeRecord->type == 'downloads');

and use it like:

'multiSRC' => array
(
    'inputType'               => 'fileTree',
    'eval'                    => array('multiple'=>true, 'isGallery'=>true, 'fieldType'=>'checkbox', 'orderField'=>'orderSRC', 'files'=>true, 'mandatory'=>true),
),

@leofeyer
Copy link
Member

Changed in da1ec2f. You can add your own types in the DCA:

// Display sortable images
$GLOBALS['TL_DCA']['tl_content']['fields']['type']['eval']['gallery_types'][] = 'custom_type';

// Display sortable files (allowed download types only)
$GLOBALS['TL_DCA']['tl_content']['fields']['type']['eval']['downloads_types'][] = 'custom_type';

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants