1 file.install file_update_1010()

Ensures that the "no results" text in 'file_admin' view has a valid format.


core/modules/file/file.install, line 1233
Install, update and uninstall functions for File module.


function file_update_1010() {
  // Back in file_update_1000() we created this view containing 'filtered_html'
  // as the "no results" text format, but if we were upgrading from a site that
  // didn't contain that format, it results in an error. Here we ensure that the
  // format for that text is a valid format and if it isn't, use the fallback
  // format. Check the format for all displays, in case the user has modified
  // the page from the default.
  $config = config('views.view.file_admin');
  $displays = $config->get('display');
  if (!empty($displays)) {
    $filter_format_configs = config_get_names_with_prefix('filter.format.');
    foreach ($displays as &$display) {
      if (isset($display['display_options']['empty']['area']['format'])) {
        $format = $display['display_options']['empty']['area']['format'];
        if (in_array('filter.format.' . $format, $filter_format_configs)) {
        $display['display_options']['empty']['area']['format'] = filter_fallback_format();
    $config->set('display', $displays);