1 file.admin.inc file_type_toggle_enable($type, $status)

Menu callback; disable or enable a single file type.

File

core/modules/file/file.admin.inc, line 399
Admin page callbacks for the File module.

Code

function file_type_toggle_enable($type, $status) {
  // Validate the token for this page.
  if (empty($_GET['token']) || $_GET['token'] !== backdrop_get_token($type->type)) {
    return MENU_ACCESS_DENIED;
  }
  $type->disabled = !$status;
  file_type_save($type);
  if ($status) {
    $message = t('The file type %name has been enabled.', array('%name' => $type->name));
  }
  else {
    $message = t('The file type %name has been disabled.', array('%name' => $type->name));
  }
  backdrop_set_message($message);
  backdrop_goto('admin/structure/file-types');
}