You are here

function community_tags_ui_tag_alternative in Community Tags 6.2

This just renders the usual JS enabled CT form in the dialog. Doesn't work if the 'enter' is pressed instead of the add button. NOT CURRENTLY USED.

@todo - handle enter button and make available as alternative dialog style.

File

community_tags_ui/community_tags_ui.module, line 145
Provides Dialog integration for community tags. 'Tag this' links in teasers and nodes are altered to open a dialog.

Code

function community_tags_ui_tag_alternative($node, $vid, $ajax = FALSE, $pid = NULL) {
  global $user;
  module_load_include('inc', 'community_tags', 'community_tags.pages');

  // TODO: comment_reply does a whole bunch of access checking and other
  // stuff. Not sure how much we should do here, beyond the user_access below
  if (!user_access('tag content')) {

    // TODO: maybe we should have a dialog_access_denied().
    $commands = array();
    $commands[] = dialog_command_display(t('Access denied'), t('You are not authorized to access this page.'));
    ctools_ajax_render($commands);

    // implicit exit();
  }
  $output = community_tags_node_view($node, FALSE, $vid);
  if (!$ajax) {
    return $output;
  }
  else {
    dialog_ajax_render(t('Tag %title', array(
      '%title' => $node->title,
    )), $output, array(
      'width' => 300,
    ));
  }
}