-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathworkbench.module
More file actions
64 lines (59 loc) · 1.79 KB
/
workbench.module
File metadata and controls
64 lines (59 loc) · 1.79 KB
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
<?php
/**
* @file
* Workbench module file for editorial workspaces.
*/
/**
* Implements hook_theme().
*
* Provides a theme function for use with the RenderAPI that uses the #title and
* #attributes properties of a render array, if they're present.
*/
function workbench_theme($existing, $type, $theme, $path) {
return array(
'workbench_element' => array(
'render element' => 'element',
'file' => 'workbench.theme.inc',
),
);
}
/**
* Implementation of template_preprocess_views_view_field().
*
* This is done to convert the "type" field to a thumbnail for image files.
*/
function workbench_preprocess_views_view_field(&$variables) {
if ($variables['view']->id() == 'workbench_current_user' && $variables['field']->field == 'user_picture') {
if (empty($variables['row']->_entity->get('user_picture')->getValue())) {
// We could put the default picture here.
$output = array(
'#theme' => 'image',
'#attributes' => array(
'width' => '100px',
'src' => '/' . drupal_get_path('module', 'workbench') . '/images/profile_default.png',
),
);
$variables['output'] = drupal_render($output);
}
}
}
/**
* Implements hook_ctools_plugin_directory().
*
* Let the system know where our task and task_handler plugins are.
*/
function workbench_ctools_plugin_directory($owner, $plugin_type) {
if ($owner == 'page_manager') {
return 'plugins/page_manager/' . $plugin_type;
}
}
/**
* Implements hook_ctools_plugin_api().
*/
function workbench_ctools_plugin_api($module, $api) {
// This includes a check for whether Panels is enabled since the Page Manager
// export is for Panels.
if ($module == 'page_manager' && $api == 'pages_default' && module_exists('panels')) {
return array('version' => 1);
}
}