How do I create a file set add images to it
Permalink Browser Info Environment
I can't seem to make this add on work please help.
how do we add files to the file set
how do we add files to the file set
Type: | Discussion |
---|---|
Status: | New |
Okay, but how does one do this programmatically? I have a single page form for admins that allows them to add slides to a slide show. I'd love to have every slide they add automatically get included in the "slide" file set or to have the file manager selector that gets called up to just show "slide" file set.
Doesn't seem to be working. When I click the form for the image selector, I still get all the images not just the ones in the set I want.
$alh=Loader::helper('concrete/asset_library' ); $fsName = "Slides"; $fs = FileSet::getByName( $fsName ); $fsID = $fs->getFileSetID(); $filterArgs = array( 'fType' => FileType::T_IMAGE, 'fsID' => $fsID, ); echo $alh->image( 'imageFileSelector', 'fileManagerSelectionID', t('Select slide image'), $filterArgs );
Doesn't seem to be working. When I click the form for the image selector, I still get all the images not just the ones in the set I want.
To add a file to a file set, you pass the file id to the file set object's addFileToSet() function. For example:
(this code would be in your controller when it processes the form POST).
if (!empty($_POST['fileManagerSelectionID'])) { $fID = $_POST['fileManagerSelectionID']; $fs = FileSet::getByName('Slides'); $fs->addFileToSet($fID); }
(this code would be in your controller when it processes the form POST).
-Jordan