Making your own repository plugin. Building list array

Making your own repository plugin. Building list array

by steve baxter -
Number of replies: 0

I have been writing a repository module for our own in house repository. I discovered a nugget of information which would have saved me many hours of hair pulling when constructing the array of results. From the repository API documentation

 // file picker will build a file tree according this
   // list
   'list' => array(
     array( // file
       'title' => (string) file name,
       'shorttitle' => (string) optional, if you prefer to display a short title
       'date' => (string) file last modification time, usually userdate(...),
       'size' => (int) file size,
       'thumbnail' => (string) url to thumbnail for the file,
       'thumbnail_width' => (int) the width of the thumbnail image,
       'source' => plugin-dependent unique path to the file (id, url, path, etc.),
       'url'=> the accessible url of file
     ),

The difficulty was with the source item. There wasn't a Iot of information to go on so I couldn't work out how to separate the URL from the description when the item finally displayed. Simply adding a # between them sorted it like this:

$file_source="http://the_url_of_the_file";
$file_description="the_description_of_the_file";

 $list[] = array(
                   "title"=>(string)"$file_title",
                   "thumbnail"=>(string)"$file_thumbnail",
                   "thumbnail_width"=>(int)150,
                   "thumbnail_height"=>(int)30,
                   "size"=>(string)"",
                   "date"=>(string)"$file_date",
                   "source"=>(string)"$file_source#$file_description"
);

Hope that helps someone.

 



Average of ratings: -