You are here

function file_admin_unpublish_action in File admin 7

Sets the published field of a file to 0 (unpublished).

Parameters

file_entity $file_entity: A file entity object.

array $context: (optional) Array of additional information about what triggered the action. Not used for this action.

File

./file_admin.module, line 433
Enhances file administration by adding published, promote, and sticky fields.

Code

function file_admin_unpublish_action($file_entity, $context = array()) {
  file_admin_mass_update(array(
    'fid' => $file_entity->fid,
  ), array(
    'published' => FILE_NOT_PUBLISHED,
  ));
  if (!empty($file_entity->title)) {
    $title = $file_entity->title;
  }
  else {
    $title = $file_entity->filename;
  }
  watchdog('action', 'Set @type %title to unpublished.', array(
    '@type' => file_get_type($file_entity),
    '%title' => $title,
  ));
}