function _subscriptions_content_node_options in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions_content.module \_subscriptions_content_node_options()
- 7 subscriptions_content.module \_subscriptions_content_node_options()
- 2.0.x subscriptions_content/subscriptions_content.module \_subscriptions_content_node_options()
Implementation of hook_node_options(), subhook of hook_subscriptions().
This is called by subscriptions_ui_node_form() in subscriptions_ui.module.
See also
File
- ./
subscriptions_content.module, line 82 - Subscriptions to content events
Code
function _subscriptions_content_node_options($account, $node) {
// Default node, field are the first three indexes, but they can be overridden in params
// Thread
$options = array();
$statics = variable_get('subscriptions_static_content_types', array());
if (!in_array($node->type, $statics)) {
$options['nid'][] = array(
'name' => t('Subscribe to this page'),
'params' => array(
'module' => 'node',
'field' => 'nid',
'value' => $node->nid,
),
'link' => 'node/' . $node->nid,
);
$options['nid']['weight'] = -4;
}
$unlisteds = variable_get('subscriptions_unlisted_content_types', array());
if (user_access('subscribe to content types', $account)) {
$unlisted_tag = '';
if (in_array($node->type, $unlisteds)) {
if (user_access('subscribe to all content types', $account)) {
$unlisted_tag = ' ' . SUBSCRIPTIONS_UNAVAILABLE;
}
else {
return $options;
}
}
// Content type
$type_name = node_get_types('name', $node->type);
if ($type_name) {
$options['type'][] = array(
'name' => t('To %type content', array(
'%type' => $type_name,
)) . $unlisted_tag,
'params' => array(
'module' => 'node',
'field' => 'type',
'value' => $node->type,
),
'link' => 'type/' . $node->type,
);
// Content type and author
$options['type'][] = array(
'name' => t('To %type content by %name', array(
'%type' => $type_name,
'%name' => $node->uid ? check_plain($node->name) : variable_get('anonymous', '???'),
)) . $unlisted_tag,
'params' => array(
'module' => 'node',
'field' => 'type',
'value' => $node->type,
'author_uid' => $node->uid,
),
'link' => 'type/' . $node->type . '/' . $node->uid,
);
$options['type']['weight'] = -2;
}
}
return $options;
}