You are here

function publishcontent_views_handler_node_publish in Publish Content 5.2

Same name and namespace in other branches
  1. 5 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 144
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 ($data->status && _publishcontent_unpublish_access($data) || !$data->status && _publishcontent_publish_access($data)) {
    return l(t($data->status ? 'Unpublish' : 'Publish'), "node/{$data->nid}/" . ($data->status ? 'unpublish/' : 'publish/') . drupal_get_token(), NULL, $destination);
  }
}