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

Type: Discussion
Status: New
trimblec
View Replies:
jordanlev replied on at Permalink Reply
jordanlev
Go to the file manager (in the dashboard), upload images (if you haven't already), then you can add them to a file set - either one by one by clicking on an image and choosing "File Sets" from the popup menu, or in bulk by checking the boxes next to the images you want to add to a set and then choosing "Sets" from the "**" dropdown at the top of the file list.

-Jordan
bubbahotep replied on at Permalink Reply
bubbahotep
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.

$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.
jordanlev replied on at Permalink Reply
jordanlev
To add a file to a file set, you pass the file id to the file set object's addFileToSet() function. For example:
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).

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.