From c6beca5ae8b1fea0453f23b5885f21befb526479 Mon Sep 17 00:00:00 2001 From: Nelson Hart Date: Wed, 4 Sep 2013 09:17:07 -0300 Subject: [PATCH 1/5] allow mulitple mime types for viewers --- includes/solution_packs.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc index 7cf0351a..337f76c4 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -679,11 +679,17 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model = function islandora_get_viewers($mimetype = NULL, $content_model = NULL) { $viewers = array(); $defined_viewers = module_invoke_all('islandora_viewer_info'); + + if(!is_array($mimetype)) { + $mimetype = array($mimetype); + } + // Filter viewers by MIME type. foreach ($defined_viewers as $key => $value) { $value['mimetype'] = isset($value['mimetype']) ? $value['mimetype'] : array(); $value['model'] = isset($value['model']) ? $value['model'] : array(); - if (in_array($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) { + if (array_intersect($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) { + //if (in_array($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) { $viewers[$key] = $value; } } From f486133fbbe72869ee50fe86eb965a85091cab25 Mon Sep 17 00:00:00 2001 From: Nelson Hart Date: Wed, 12 Feb 2014 10:44:56 -0400 Subject: [PATCH 2/5] remove comment --- includes/solution_packs.inc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc index 30cc8576..6f4b4ae3 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -256,7 +256,7 @@ function islandora_solution_pack_form_submit(array $form, array &$form_state) { * the batch. * @param array $not_checked * The object that will bot be install. - * + * * @return array * An array defining a batch which can be passed on to batch_set(). */ @@ -735,7 +735,6 @@ function islandora_get_viewers($mimetype = NULL, $content_model = NULL) { $value['mimetype'] = isset($value['mimetype']) ? $value['mimetype'] : array(); $value['model'] = isset($value['model']) ? $value['model'] : array(); if (array_intersect($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) { - //if (in_array($mimetype, $value['mimetype']) OR in_array($content_model, $value['model'])) { $viewers[$key] = $value; } } From 3bdd909e15d5f3b340d3d97aff8fac0426782d21 Mon Sep 17 00:00:00 2001 From: Nelson Hart Date: Wed, 12 Feb 2014 10:49:42 -0400 Subject: [PATCH 3/5] docs update for array of mime types --- includes/solution_packs.inc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc index 6f4b4ae3..0ff7d253 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -712,9 +712,8 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model = * given, than any viewer that supports either the give $mimetype or $model will * be listed. * - * @param string $mimetype - * Specify a mimetype to return only viewers that support this certain - * mimetype. + * @param array $mimetype + * List of mimetypes that the view supports. * @param string $content_model * Specify a content model to return only viewers that support the content * model. @@ -722,7 +721,7 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model = * @return array * Viewer definitions, or FALSE if none are found. */ -function islandora_get_viewers($mimetype = NULL, $content_model = NULL) { +function islandora_get_viewers($mimetype = array(), $content_model = NULL) { $viewers = array(); $defined_viewers = module_invoke_all('islandora_viewer_info'); From ecb4f09766176fcc0564916f9f046afdf09adea2 Mon Sep 17 00:00:00 2001 From: Nelson Hart Date: Wed, 12 Feb 2014 10:50:43 -0400 Subject: [PATCH 4/5] spelling --- includes/solution_packs.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc index 0ff7d253..d875bc69 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -713,7 +713,7 @@ function islandora_viewers_form($variable_id = NULL, $mimetype = NULL, $model = * be listed. * * @param array $mimetype - * List of mimetypes that the view supports. + * List of mimetypes that the viewer supports. * @param string $content_model * Specify a content model to return only viewers that support the content * model. From 656d2b13058ada19e0a9a7dd670a0826dcf4370e Mon Sep 17 00:00:00 2001 From: Nelson Hart Date: Thu, 13 Feb 2014 14:58:37 -0400 Subject: [PATCH 5/5] cs fixes --- includes/solution_packs.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/solution_packs.inc b/includes/solution_packs.inc index d875bc69..0209ecbd 100644 --- a/includes/solution_packs.inc +++ b/includes/solution_packs.inc @@ -725,7 +725,7 @@ function islandora_get_viewers($mimetype = array(), $content_model = NULL) { $viewers = array(); $defined_viewers = module_invoke_all('islandora_viewer_info'); - if(!is_array($mimetype)) { + if (!is_array($mimetype)) { $mimetype = array($mimetype); }