function context_contrib_context_conditions in Context 6.2
Same name and namespace in other branches
- 6 context_contrib/context_contrib.module \context_contrib_context_conditions()
Implementation of hook_context_conditions().
File
- context_contrib/
context_contrib.module, line 6
Code
function context_contrib_context_conditions() {
$items = array();
// Views
if (module_exists('views')) {
drupal_add_js(drupal_get_path('module', 'context_contrib') . '/context_contrib.js');
$items['views'] = array(
'#title' => t('Views'),
'#description' => t('Set this context when displaying the page of one of these views.'),
'#options' => _context_contrib_get_views(),
'#type' => 'checkboxes',
);
}
// Nodequeue
if (module_exists('nodequeue')) {
$result = db_query("SELECT qid, title FROM {nodequeue_queue}");
$options = array();
while ($nq = db_fetch_object($result)) {
$options[$nq->qid] = $nq->title;
}
$items['nodequeue'] = array(
'#title' => t('Nodequeue'),
'#description' => t('Set this context when a node in the selected nodequeue(s) is viewed.'),
'#options' => $options,
'#type' => 'checkboxes',
);
}
// CCK
if (module_exists('content')) {
foreach (content_fields() as $field) {
if ($options = content_allowed_values($field)) {
$items[$field['field_name']] = array(
'#title' => t('CCK Field: @field_label', array(
'@field_label' => $field['widget']['label'],
)),
'#type' => 'checkboxes',
'#options' => $options,
'#description' => filter_xss_admin($field['widget']['description']),
);
}
}
}
return $items;
}