function _views_file_status

Same name and namespace in other branches
  1. 9 core/modules/file/file.module \_views_file_status()

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.

1 call to _views_file_status()
Status::getValueOptions in core/modules/file/src/Plugin/views/filter/Status.php
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

File

core/modules/file/file.module, line 1825

Code

function _views_file_status($choice = NULL) {
    $status = [
        0 => t('Temporary'),
        FILE_STATUS_PERMANENT => t('Permanent'),
    ];
    if (isset($choice)) {
        return isset($status[$choice]) ? $status[$choice] : t('Unknown');
    }
    return $status;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.