-
Notifications
You must be signed in to change notification settings - Fork 5
/
transcripts_ui.api.php
executable file
·73 lines (67 loc) · 1.94 KB
/
transcripts_ui.api.php
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
<?php
/**
* @file
* Exposed Hooks
*/
/**
* Retrieve transcript given some UI settings. If a term
* has been searched for, then return highlights as well.
*
* This hook is invoked if you create a TranscriptUI object
* by calling transcripts_ui_ui() with your module name as
* the first argument.
*
* An array of time code units and highlights is returned.
* Time code units should be an array of objects, each of
* which must have the following properties:
*
* $obj->id : unique identifier
* $obj->speaker : speaker name
* $obj->start : start time in seconds
* $obj->end : end time in seconds
*
* In addition, there should be a property for each tier.
* Assuming your tiers are Esperanto, Quenya, and Sindarin:
*
* $obj->ts_content_epo
* $obj->ts_content_qya
* $obj->ts_content_sjn
*
* Highlights are returned in Solr format, with snippets
* keyed by id to a time code unit. Return NULL if there
* hasn't been a term search or there are no highlights.
*
* @param TranscriptUI $ui
* A transcript ui containing relevant settings.
*
* @return array($tcus, $highlights)
*
*/
function hook_transcripts_ui_transcript($ui)
{
$response = solr_query($ui);
$tcus = $response->response->docs;
$highlights = isset($response->highlighting) ? $response->highlighting : NULL;
return array($tcus, $highlights);
}
function hook_transcripts_ui_js_alter(&$scripts)
{
$scripts['ui'] = drupal_get_path('module', 'my_module') . '/js/my_ui.js';
$scripts['scroller'] = drupal_get_path('module', 'my_module') . '/js/my_scroller.js';
}
function hook_transcripts_ui_tcu_alter(&$tcu)
{
}
function hook_transcripts_ui_transcript_alter(&$transcript)
{
$modal = array(
'modal' => array(
'#markup' => theme('transcripts_editor_tcu_delete_modal',
array(
'trid' => $transcript['#trid'],
)
),
),
);
$transcript = $modal + $transcript;
}