-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathdefault.php
More file actions
29 lines (24 loc) · 1020 Bytes
/
default.php
File metadata and controls
29 lines (24 loc) · 1020 Bytes
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
<?php
/**
* @version $Id$
* @author Matthew McNaney <mcnaney at gmail dot com>
*/
javascript('jquery');
if (isset($data['match']) && is_array($data['match'])) {
foreach ($data['match'] as $match) {
$link = sprintf('<a href="#" onclick="remove(\'%s\', \'%s\'); return false;">%s</a>',
$data['id'], $match, $data['options'][$match]);
$input = sprintf('<input id="%s-hidden" type="hidden" name="%s[]" value="%s" />', $data['id'], $data['select_name'], $match);
$divs[] = sprintf('<div id="%s-add-%s">%s%s</div>', $data['id'], $match, $link, $input);
unset($data['options'][$match]);
}
$data['default_matches'] = implode("\n", $divs);
}
if (empty($data['options']) || !is_array($data['options'])) {
$data['option-list'][] = array('value'=>0, 'pick'=> _('No options passed to function'));
} else {
foreach ($data['options'] as $key=>$opt) {
$data['option-list'][] = array('value'=>$key, 'pick'=>$opt);
}
}
$default['add'] = '+';