From 74eff1aa95a5dae06c7ddc6a8ffb81fdd563b8cf Mon Sep 17 00:00:00 2001 From: Silvio Date: Fri, 22 Oct 2010 19:33:06 -0200 Subject: Accepting title parameter --- jquery_gallery_view.module | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/jquery_gallery_view.module b/jquery_gallery_view.module index 4799101..04f46a8 100644 --- a/jquery_gallery_view.module +++ b/jquery_gallery_view.module @@ -10,20 +10,26 @@ * Setup photos for a view. * * @param $view - * View data. + * View data. + * + * @param $field + * File field name. + * + * @param $title + * Title field name. */ -function jquery_gallery_view_setup_photos($view, $field) { +function jquery_gallery_view_setup_photos($view, $field, $title = NULL) { // Setup files folder. $files = variable_get('file_directory_path', conf_path() .'/files'); foreach ($view->result as $result) { - $fid = $result->{'node_data_field_'. $field .'_fid'}; + $fid = $result->{$field}; if ($fid != NULL) { - $file = field_file_load($fid); - $data = unserialize($result->{'node_data_field_'. $field .'_data'}); + $file = field_file_load($fid); + $text = $result->{$title}; $photos[] = array( 'filename' => $file['filename'], - 'title' => $data['title'], + 'title' => $text, ); } } -- cgit v1.2.3