You are here

function flagging_dialog_command_update_link in Flagging Form 7.3

Same name and namespace in other branches
  1. 7 flagging_dialog.module \flagging_dialog_command_update_link()

Creates a Drupal AJAX command to update a flag link.

1 call to flagging_dialog_command_update_link()
flagging_dialog_process_form_result in ./flagging_dialog.module
Handles submission of the form.

File

./flagging_dialog.module, line 280
Provides menu callbacks for displaying the flagging forms in a dialog box.

Code

function flagging_dialog_command_update_link($flag, $content_id, $status_has_changed) {

  // @todo: We're mimicing here the JavsScript structure flag_page() builds.
  // Let's factor out the flag_page() code and use it instead.
  return array(
    'command' => 'flagging_dialog_update_link',
    'flagName' => $flag->name,
    'contentId' => $content_id,
    // @todo: it was pointed out already, in a comment in flagging_form.module,
    // that we don't have a special message to print when a flagging is updated
    // (as opposed to created or deleted). When we factor flag_page() we should
    // make things future-proof to also work when we do have such a message.
    'newLink' => $flag
      ->theme($flag
      ->is_flagged($content_id) ? 'unflag' : 'flag', $content_id, array(
      $status_has_changed,
    )),
  );
}