diff options
-rw-r--r-- | jquery_gallery_view.module | 18 |
1 files 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, ); } } |