updated core from 8.4 to 8.5 : bug with login_destination

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-13 14:01:21 +01:00
parent 0d78da249b
commit e668535a4e
3486 changed files with 89604 additions and 33283 deletions
+36
View File
@@ -5,6 +5,8 @@
* Install, update and uninstall functions for File module.
*/
use Drupal\Core\Entity\Entity\EntityViewDisplay;
/**
* Implements hook_schema().
*/
@@ -128,3 +130,37 @@ function file_update_8300() {
return t('Files that have no remaining usages are no longer deleted by default.');
}
/**
* Add 'use_description_as_link_text' setting to file field formatters.
*/
function file_update_8001() {
$displays = EntityViewDisplay::loadMultiple();
foreach ($displays as $display) {
/** @var \Drupal\Core\Entity\Entity\EntityViewDisplay $display */
$fields_settings = $display->get('content');
$changed = FALSE;
foreach ($fields_settings as $field_name => $settings) {
if (!empty($settings['type'])) {
switch ($settings['type']) {
// The file_table formatter never displayed available descriptions
// before, so we disable this option to ensure backward compatibility.
case 'file_table':
$fields_settings[$field_name]['settings']['use_description_as_link_text'] = FALSE;
$changed = TRUE;
break;
// The file_default formatter always displayed available descriptions
// before, so we enable this option to ensure backward compatibility.
case 'file_default':
$fields_settings[$field_name]['settings']['use_description_as_link_text'] = TRUE;
$changed = TRUE;
break;
}
}
}
if ($changed === TRUE) {
$display->set('content', $fields_settings)->save();
}
}
}