Skip to content
Snippets Groups Projects
Commit 694650fa authored by catch's avatar catch
Browse files

Issue #2032893 by Thomas Brekelmans, srilakshmier, longwave, Mile23, dawehner,...

Issue #2032893 by Thomas Brekelmans, srilakshmier, longwave, Mile23, dawehner, daffie, damiankloip, xjm, tstoeckler, slashrsm: Deprecate the function _views_file_status()
parent 150da35a
No related branches found
No related tags found
No related merge requests found
......@@ -1778,8 +1778,14 @@ function file_get_file_references(FileInterface $file, FieldDefinitionInterface
*
* @return \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 https://www.drupal.org/node/3227228
*/
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'),
......
......@@ -2,6 +2,7 @@
namespace Drupal\file\Plugin\views\filter;
use Drupal\file\FileInterface;
use Drupal\views\Plugin\views\filter\InOperator;
/**
......@@ -15,7 +16,10 @@ class Status extends InOperator {
public function getValueOptions() {
if (!isset($this->valueOptions)) {
$this->valueOptions = _views_file_status();
$this->valueOptions = [
0 => $this->t('Temporary'),
FileInterface::STATUS_PERMANENT => $this->t('Permanent'),
];
}
return $this->valueOptions;
}
......
......@@ -34,4 +34,14 @@ public function testFileSaveUploadSingleErrorFormSize() {
$this->assertEquals($expected_message, \Drupal::messenger()->all()['error'][0]);
}
/**
* Tests the deprecation of _views_file_status().
*
* @group legacy
*/
public function testViewsFileStatus() {
$this->expectDeprecation('_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');
$this->assertIsArray(_views_file_status());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment