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

Link Files for Image #5863

Closed
oliverstorm opened this issue May 31, 2013 · 9 comments
Closed

Link Files for Image #5863

oliverstorm opened this issue May 31, 2013 · 9 comments
Assignees
Labels
Milestone

Comments

@oliverstorm
Copy link

Would be good to be able to choose file for Image.
As Sample i have an image and want to link it to an pdf in files. At the moment i can only choose a page but not a file to be linked by image.
At the moment this link must be set manually.
filepicker-image

@leofeyer
Copy link
Member

Why don't you use the link element instead?

@oliverstorm
Copy link
Author

There i´m not able to pick file from Filemanager as well?!
i just can pick a site but not a file (pdf)

@oliverstorm
Copy link
Author

today on an other project forced this issue again.
have some ce_text with image. and need to link image to pdf file. but not able to pick file. just pages.
what would be nice is for example if "Page picker" opens up, in header, addtionally to "Die Seitenstruktur bearbeiten" something link "Datei auswählen"

@NinaG
Copy link

NinaG commented Mar 18, 2014

Still a big issue for my Contao users. So +1 for the idea.

@mrflory
Copy link

mrflory commented Feb 5, 2015

This issue still bothers me (and my customers). In tinyMCE the switch from file to site chooser is already implemented. Can this be done for the link and download elements as well?

@mrflory
Copy link

mrflory commented Mar 28, 2015

I came up with the following workaround: I created a dcaconfig.php file in the config folder with the following code:

if (!class_exists('tl_dcaconfig')) {
    $GLOBALS['TL_DCA']['tl_content']['fields']['url']['eval']['filesOnly'] = true;
    $GLOBALS['TL_DCA']['tl_content']['fields']['url']['wizard'][] = array('tl_dcaconfig', 'filePicker');

    class tl_dcaconfig
    {
        /**
         * Return the file picker wizard
         * @param \DataContainer
         * @return string
         */
        public function filePicker(DataContainer $dc)
        {
            return ' <a href="contao/file.php?do='.Input::get('do').'&amp;table='.$dc->table.'&amp;field='.$dc->field.'&amp;value='.$dc->value.'" title="'.specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MSC']['filepicker'])).'" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\''.specialchars($GLOBALS['TL_LANG']['MOD']['files'][0]).'\',\'url\':this.href,\'id\':\''.$dc->field.'\',\'tag\':\'ctrl_'.$dc->field . ((Input::get('act') == 'editAll') ? '_' . $dc->id : '').'\',\'self\':this});return false">' . Image::getHtml('pickfile.gif', $GLOBALS['TL_LANG']['MSC']['filepicker'], 'style="vertical-align:top;cursor:pointer"') . '</a>';
        }
    }
}

This adds a file picker button next to the page picker button. Any improvements are welcome.

@leofeyer
Copy link
Member

Fixed in contao/core-bundle@46ee448. Needs to be back ported.

@leofeyer leofeyer added defect and removed feature labels May 15, 2015
@leofeyer leofeyer modified the milestones: 3.5.0, x.x.x May 15, 2015
@leofeyer leofeyer self-assigned this May 15, 2015
@leofeyer
Copy link
Member

leofeyer commented Jun 2, 2015

Back ported in 18010b5.

@leofeyer
Copy link
Member

leofeyer commented Jun 2, 2015

Fixed the other pickers, too, in b2641f1.

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

4 participants