function _views_file_status in Drupal 9
Same name and namespace in other branches
- 8 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()
- FileModuleTest::testViewsFileStatus in core/
modules/ file/ tests/ src/ Kernel/ FileModuleTest.php - Tests the deprecation of _views_file_status().
File
- core/
modules/ file/ file.module, line 1787 - Defines a "managed_file" Form API field and a "file" field for Field module.
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 isset($status[$choice]) ? $status[$choice] : t('Unknown');
}
return $status;
}