-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathislandora_solr_collection_view.module
85 lines (75 loc) · 2.33 KB
/
islandora_solr_collection_view.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* @file
* Provides a Collection View.
*/
define('ISLANDORA_SOLR_COLLECTION_VIEW_DEFAULT_VIEW', 'collection');
define('ISLANDORA_SOLR_COLLECTION_VIEW_DEFAULT_DISPLAY', 'block');
/**
* Implements hook_views_api().
*/
function islandora_solr_collection_view_views_api() {
return array(
'api' => '3.0',
);
}
/**
* Implements hook_menu().
*/
function islandora_solr_collection_view_menu() {
$items = array(
'admin/islandora/tools/collection_view' => array(
'title' => 'Collection view',
'description' => 'Configuration page for collection view',
'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_solr_collection_view_admin'),
'file' => 'includes/admin.inc',
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
'weight' => -1,
),
);
return ($items);
}
/**
* Implements hook_theme().
*/
function islandora_solr_collection_view_theme() {
$path = drupal_get_path('module', 'islandora_solr_collection_view');
$file = 'theme.inc';
return array(
'islandora_solr_teaser' => array(
'path' => $path . '/theme',
'file' => $file,
'template' => 'islandora-solr-teaser',
'variables' => array(
'values' => array(),
),
),
'islandora_solr_thumbnail' => array(
'path' => $path . '/theme',
'file' => $file,
'template' => 'islandora-solr-thumbnail',
'variables' => array(
'values' => array(),
),
),
);
// Results page.
}
/**
* Implements hook_CMODEL_PID_islandora_view_object().
*/
function islandora_solr_collection_view_islandora_collectionCModel_islandora_view_object(AbstractObject $object) {
// TODO: render the block so that it has contextual menus.
$enabled = variable_get('islandora_solr_collection_view_enabled', 1);
if ($enabled) {
$view_name = variable_get('islandora_solr_collection_view_default_view_name', ISLANDORA_SOLR_COLLECTION_VIEW_DEFAULT_VIEW);
$view_display = variable_get('islandora_solr_collection_view_default_display_name', ISLANDORA_SOLR_COLLECTION_VIEW_DEFAULT_DISPLAY);
$view = views_embed_view($view_name, $view_display, 'info:fedora/' . $object->id);
$view = render($view);
return array(
'collection_view' => $view,
);
}
}