Newer
Older
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
/**
* Context registry.
*/
function _context_context_registry() {
$registry = array();
$registry['conditions'] = array(
'context' => array(
'title' => t('Context'),
'description' => t('Set this context on the basis of other active contexts. Put each context on a separate line. You can use the <code>*</code> character as a wildcard and <code>~</code> to exclude one or more contexts.'),
'plugin' => 'context_condition_context',
),
'node' => array(
'title' => t('Node type'),
'description' => t('Set this context when viewing a node page or using the add/edit form of one of these content types.'),
'plugin' => 'context_condition_node',
),
'sitewide' => array(
'title' => t('Sitewide context'),
'description' => t('Should this context always be set? If <strong>true</strong>, this context will be active across your entire site.'),
'plugin' => 'context_condition_sitewide',
),
'path' => array(
'title' => t('Path'),
'description' => t('Set this context when any of the paths above match the page path. Put each path on a separate line. You can use the "*" character as a wildcard and <code>~</code> to exclude one or more paths. Use <front> for the site front page.'),
'plugin' => 'context_condition_path',
),
'user' => array(
'title' => t('User role'),
'description' => t('Set this context when the current user has one of the selected role(s).'),
'plugin' => 'context_condition_user',
),
'user_page' => array(
'title' => t('User page'),
'description' => t('Set this context when viewing a user page.'),
'plugin' => 'context_condition_user_page',
),
Steven Jones
committed
);
if (module_exists('menu')) {
$registry['conditions']['menu'] = array(
'title' => t('Menu'),
'description' => t('Set this context when any of the selected menu items belong to the current active menu trail.'),
'plugin' => 'context_condition_menu',
Steven Jones
committed
);
}
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
if (module_exists('views')) {
$registry['conditions']['views'] = array(
'title' => t('Views'),
'description' => t('Set this context when displaying the page of one of these views.'),
'plugin' => 'context_condition_views',
);
}
if (module_exists('book')) {
$registry['conditions']['book'] = array(
'title' => t('Book'),
'description' => t('Set this context when a node in the selected book is viewed.'),
'plugin' => 'context_condition_book',
);
$registry['conditions']['bookroot'] = array(
'title' => t('Book root'),
'description' => t('Set this context when viewing a node whose root book is of the selected type.'),
'plugin' => 'context_condition_bookroot',
);
}
if (module_exists('locale')) {
$registry['conditions']['language'] = array(
'title' => t('Language'),
'description' => t('Set this context when viewing the site in the selected language.'),
'plugin' => 'context_condition_language',
);
}
if (module_exists('taxonomy')) {
$registry['conditions']['node_taxonomy'] = array(
'title' => t('Taxonomy'),
'description' => t('Set this context when viewing a node with the selected taxonomy terms.'),
'plugin' => 'context_condition_node_taxonomy',
);
}
$registry['reactions'] = array(
'block' => array(
'title' => t('Blocks'),
'description' => t('Control block visibility using context.'),
'plugin' => 'context_reaction_block',
),
'breadcrumb' => array(
'title' => t('Breadcrumb'),
'description' => t('Set the breadcrumb trail to the selected menu item.'),
'plugin' => 'context_reaction_breadcrumb',
),
'theme' => array(
'title' => t('Theme'),
'description' => t('Control theme variables using context.'),
'plugin' => 'context_reaction_theme',
),
'debug' => array(
'title' => t('Debug'),
'description' => t('Debug output reaction for SimpleTest.'),
'plugin' => 'context_reaction_debug',
),
);
Steven Jones
committed
if (module_exists('menu')) {
$registry['reactions']['menu'] = array(
'title' => t('Menu'),
'description' => t('Control menu active class using context.'),
'plugin' => 'context_reaction_menu',
);
}
if (module_exists('css_injector')) {
$registry['reactions']['css_injector'] = array(
'title' => t('CSS Injector'),
'description' => t('Inject the selected css when this context is set.'),
'plugin' => 'context_reaction_css_injector',
);
}
return $registry;
}
/**
* Context plugins.
*/
function _context_context_plugins() {
$plugins = array();
/**
* Conditions.
*/
$plugins['context_condition'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition.inc',
'class' => 'context_condition',
),
);
$plugins['context_condition_context'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_context.inc',
'class' => 'context_condition_context',
'parent' => 'context_condition_path',
),
);
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
$plugins['context_condition_node'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_node.inc',
'class' => 'context_condition_node',
'parent' => 'context_condition',
),
);
$plugins['context_condition_sitewide'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_sitewide.inc',
'class' => 'context_condition_sitewide',
'parent' => 'context_condition',
),
);
$plugins['context_condition_path'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_path.inc',
'class' => 'context_condition_path',
'parent' => 'context_condition',
),
);
$plugins['context_condition_user'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_user.inc',
'class' => 'context_condition_user',
'parent' => 'context_condition',
),
);
$plugins['context_condition_user_page'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_user_page.inc',
'class' => 'context_condition_user_page',
'parent' => 'context_condition',
),
);
$plugins['context_condition_menu'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_menu.inc',
'class' => 'context_condition_menu',
'parent' => 'context_condition',
),
);
if (module_exists('taxonomy')) {
$plugins['context_condition_node_taxonomy'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_node_taxonomy.inc',
'class' => 'context_condition_node_taxonomy',
'parent' => 'context_condition_node',
),
);
}
if (module_exists('locale')) {
$plugins['context_condition_language'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_language.inc',
'class' => 'context_condition_language',
'parent' => 'context_condition',
),
);
}
if (module_exists('book')) {
$plugins['context_condition_book'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_book.inc',
'class' => 'context_condition_book',
'parent' => 'context_condition',
),
);
$plugins['context_condition_bookroot'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_bookroot.inc',
'class' => 'context_condition_bookroot',
'parent' => 'context_condition_node',
),
);
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
}
if (module_exists('views')) {
$plugins['context_condition_views'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_condition_views.inc',
'class' => 'context_condition_views',
'parent' => 'context_condition',
),
);
}
/**
* Reactions.
*/
$plugins['context_reaction'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_reaction.inc',
'class' => 'context_reaction',
),
);
$plugins['context_reaction_block'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_reaction_block.inc',
'class' => 'context_reaction_block',
'parent' => 'context_reaction',
),
);
$plugins['context_reaction_breadcrumb'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_reaction_breadcrumb.inc',
'class' => 'context_reaction_breadcrumb',
'parent' => 'context_reaction_menu',
),
);
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
$plugins['context_reaction_menu'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_reaction_menu.inc',
'class' => 'context_reaction_menu',
'parent' => 'context_reaction',
),
);
$plugins['context_reaction_theme'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_reaction_theme.inc',
'class' => 'context_reaction_theme',
'parent' => 'context_reaction',
),
);
$plugins['context_reaction_debug'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_reaction_debug.inc',
'class' => 'context_reaction_debug',
'parent' => 'context_reaction',
),
);
if (module_exists('css_injector')) {
$plugins['context_reaction_css_injector'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context') .'/plugins',
'file' => 'context_reaction_css_injector.inc',
'class' => 'context_reaction_css_injector',
'parent' => 'context_reaction',
),
);
}
return $plugins;
}