_views_file_status

_views_file_status($choice = NULL)

Formats human-readable version of file status.

Parameters

int|null $choice: (optional) An integer status code. If not set, all statuses are returned. Defaults to NULL.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup|\Drupal\Core\StringTranslation\TranslatableMarkup[] An array of file statuses or a specified status if $choice is set.

File

core/modules/file/file.module, line 1551
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function _views_file_status($choice = NULL) {
  $status = array(
    0 => t('Temporary'),
    FILE_STATUS_PERMANENT => t('Permanent'),
  );

  if (isset($choice)) {
    return isset($status[$choice]) ? $status[$choice] : t('Unknown');
  }

  return $status;
}
doc_Drupal
2016-10-29 09:57:24
Comments
Leave a Comment

Please login to continue.