function privatemsg_filter_show_tags in Privatemsg 7.2
Same name and namespace in other branches
- 6.2 privatemsg_filter/privatemsg_filter.module \privatemsg_filter_show_tags()
- 7 privatemsg_filter/privatemsg_filter.module \privatemsg_filter_show_tags()
2 calls to privatemsg_filter_show_tags()
- hook_privatemsg_view_alter in ./
privatemsg.api.php - Add content to the view thread page.
- privatemsg_filter_privatemsg_view_alter in privatemsg_filter/
privatemsg_filter.module - Implements hook_privatemsg_view_alter().
File
- privatemsg_filter/
privatemsg_filter.module, line 746 - Allows users to tag private messages and to filter based upon those tags.
Code
function privatemsg_filter_show_tags($thread_id, $show_form) {
global $user;
$element = array(
'#prefix' => '<div id="privatemsg-filter-tags">',
'#suffix' => '</div>',
'#weight' => -10,
'#attached' => array(
'css' => array(
drupal_get_path('module', 'privatemsg_filter') . '/privatemsg_filter.css',
),
),
);
if (!$show_form) {
$query = _privatemsg_assemble_query(array(
'tags',
'privatemsg_filter',
), $user, array(
$thread_id,
));
if ($query
->countQuery()
->execute()
->fetchField() == 0) {
$element['link'] = array(
'#type' => 'link',
'#href' => $_GET['q'],
'#options' => array(
'query' => array(
'show_tags_form' => TRUE,
),
'attributes' => array(
'class' => array(
'privatemsg-filter-tags-add',
),
),
),
'#title' => t('Tag this conversation'),
);
}
else {
$element['label'] = array(
'#prefix' => '<span class="privatemsg-filter-tags-label">',
'#suffix' => '</span>',
'#markup' => t('Tags:'),
);
foreach ($query
->execute()
->fetchCol(1) as $tag) {
$element['tags'][] = array(
'#type' => 'link',
'#title' => $tag,
'#href' => 'messages',
'#options' => array(
'attributes' => array(
'title' => $tag,
),
'query' => array(
'tags' => $tag,
),
),
);
}
$element['link'] = array(
'#type' => 'link',
'#href' => $_GET['q'],
'#options' => array(
'query' => array(
'show_tags_form' => TRUE,
),
'attributes' => array(
'class' => array(
'privatemsg-filter-tags-modify',
),
),
),
'#title' => t('(modify tags)'),
);
}
return $element;
}
else {
return drupal_get_form('privatemsg_filter_form', $thread_id) + $element;
}
}