Browse Source

added alternate template for collection view

pull/117/merge
Paul Pound 12 years ago
parent
commit
d232ab46f8
  1. 37
      islandora_basic_collection/islandora-basic-collection-grid.tpl.php
  2. 23
      islandora_basic_collection/islandora_basic_collection.module

37
islandora_basic_collection/islandora-basic-collection-grid.tpl.php

@ -0,0 +1,37 @@
<?php
/*
* islandora-basic-collection.tpl.php
*
*
*
* This file is part of Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<?php drupal_set_title('grid_view'); ?>
<div class="islandora-basic-collection-wrapper">
<div class="islandora-basic-collection clearfix">
<?php print($variables['pager']); ?>
<?php foreach($associated_objects_array as $key => $value): ?>
<dl class="islandora-basic-collection-object <?php print $value['class']; ?>">
<dt class="islandora-basic-collection-thumb"><?php print $value['thumb_link']; ?></dt>
<dd class="islandora-basic-collection-caption"><?php print $value['title_link']; ?></dd>
</dl>
<?php endforeach; ?>
<?php print($variables['pager']); ?>
</div>
</div>

23
islandora_basic_collection/islandora_basic_collection.module

@ -176,6 +176,11 @@ function islandora_basic_collection_theme($existing, $type, $theme, $path) {
//an example template would be named islandora-basic-image--islandora-27.tpl.phps //an example template would be named islandora-basic-image--islandora-27.tpl.phps
'variables' => array('islandora_object' => NULL), 'variables' => array('islandora_object' => NULL),
), ),
'islandora_basic_collection_grid' => array(
'template' => 'islandora-basic-collection-grid',
'pattern' => 'islandora_basic_collection_grid__',
'variables' => array('islandora_object' => NULL),
),
'islandora_basic_collection_management_form_table' => array( 'islandora_basic_collection_management_form_table' => array(
'arguments' => array('element' => NULL), 'arguments' => array('element' => NULL),
'file' => 'includes/CollectionManagerTable.inc', 'file' => 'includes/CollectionManagerTable.inc',
@ -216,13 +221,27 @@ function islandora_basic_collection_islandora_view_object($object, $user) {
$models = $object->models; $models = $object->models;
foreach ($object->models as $model) { foreach ($object->models as $model) {
if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) { if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) {
$output = theme('islandora_basic_collection', array('islandora_object' => $object)); $display = (empty($_GET['display'])) ? 'list' : $_GET['display'];
return array('' => $output); if($display == 'grid'){
$output = theme('islandora_basic_collection_grid', array('islandora_object' => $object));
} else {
$output = theme('islandora_basic_collection', array('islandora_object' => $object));
}
return array('Collection View' => $output);
} }
} }
return NULL; return NULL;
} }
/**
* list view preprocess
* currently just calls normal view preprocess as variables are the same
* @param type $variables
*/
function islandora_basic_collection_preprocess_islandora_basic_collection_grid(&$variables){
islandora_basic_collection_preprocess_islandora_basic_collection($variables);
}
/** /**
* *
* @global type $base_url * @global type $base_url

Loading…
Cancel
Save