You are here

function publishcontent_views_handler_node_publish in Publish Content 5

Same name and namespace in other branches
  1. 5.2 publishcontent.module \publishcontent_views_handler_node_publish()

display a link to publish a node

1 call to publishcontent_views_handler_node_publish()
publishcontent_views_handler_node_publish_destination in ./publishcontent.module
display a link to edit a node with a destination return

File

./publishcontent.module, line 104
Add button to publish or unpublish a node, with access control based on the node type

Code

function publishcontent_views_handler_node_publish($fieldinfo, $fielddata, $value, $data, $destination = NULL) {

  // try to build a fake node object
  $data->type = $data->node_type;
  $data->uid = $data->node_uid;
  $data->status = $data->node_status;
  if (user_access('un/publish ' . check_plain($data->type) . ' content') || user_access('un/publish *all* content')) {
    return l(t($data->status ? 'Unpublish' : 'Publish'), "node/{$data->nid}/" . ($data->status ? 'unpublish' : 'publish'), NULL, $destination);
  }
}