function _views_file_status

Same name in other branches
  1. 8.9.x 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.

Deprecated

in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement.

See also

https://www.drupal.org/node/3227228

1 call to _views_file_status()
LegacyFileTest::testViewsFileStatus in core/modules/file/tests/src/Kernel/LegacyFileTest.php
Tests the deprecation of _views_file_status().

File

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

Code

function _views_file_status($choice = NULL) {
    @trigger_error('_views_file_status() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3227228', E_USER_DEPRECATED);
    $status = [
        0 => t('Temporary'),
        FileInterface::STATUS_PERMANENT => t('Permanent'),
    ];
    if (isset($choice)) {
        return $status[$choice] ?? t('Unknown');
    }
    return $status;
}

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