diff --git a/docroot/sites/all/modules/contrib/file_entity/file_entity.field.inc b/docroot/sites/all/modules/contrib/file_entity/file_entity.field.inc index 8ac06f2e..892b1617 100644 --- a/docroot/sites/all/modules/contrib/file_entity/file_entity.field.inc +++ b/docroot/sites/all/modules/contrib/file_entity/file_entity.field.inc @@ -437,10 +437,17 @@ function file_entity_field_formatter_view($entity_type, $entity, $field, $instan if (isset($item['description'])) { $file->description = $item['description']; } + + $text = $settings['text']; + if (module_exists('i18n_string')) { + $key = 'file_entity:file_download_link:' . $entity_type . ':' . $instance['bundle'] . ':link_text:' . $text; + $text = i18n_string($key, $text); + } + $element[$delta] = array( '#theme' => 'file_entity_download_link', '#file' => $file, - '#text' => $settings['text'], + '#text' => $text, ); } } diff --git a/docroot/sites/all/modules/contrib/file_entity/file_entity.i18n.inc b/docroot/sites/all/modules/contrib/file_entity/file_entity.i18n.inc new file mode 100644 index 00000000..4ef586d7 --- /dev/null +++ b/docroot/sites/all/modules/contrib/file_entity/file_entity.i18n.inc @@ -0,0 +1,40 @@ + t('File Entity'), + 'format' => FALSE, + ); + return $groups; +} + +/** + * Implements hook_i18n_string_list(). + */ +function file_entity_i18n_string_list($group) { + if ($group == 'file_entity') { + $fields = field_info_instances(); + + $strings = array(); + foreach ($fields as $entity_type => $bundles) { + foreach ($bundles as $bundle => $fields) { + foreach ($fields as $field_key => $field_settings) { + foreach ($field_settings['display'] as $view_mode => $view_mode_settings) { + if (!empty($view_mode_settings['type']) && $view_mode_settings['type'] == 'file_download_link') { + $text = $view_mode_settings['settings']['text']; + + $key = $entity_type . ':' . $bundle . ':' . 'link_text'; + + $strings['file_entity']['file_download_link'][$key][$text] = $text; + } + } + } + } + } + + return $strings; + } +} diff --git a/docroot/sites/all/modules/contrib/file_entity/file_entity.info b/docroot/sites/all/modules/contrib/file_entity/file_entity.info index 3d094a64..3c128d53 100644 --- a/docroot/sites/all/modules/contrib/file_entity/file_entity.info +++ b/docroot/sites/all/modules/contrib/file_entity/file_entity.info @@ -32,8 +32,8 @@ configure = admin/config/media/file-settings ; We have to add a fake version so Git checkouts do not fail Media dependencies version = 7.x-2.x-dev -; Information added by Drupal.org packaging script on 2021-11-10 -version = "7.x-2.33" +; Information added by Drupal.org packaging script on 2021-12-15 +version = "7.x-2.35" core = "7.x" project = "file_entity" -datestamp = "1636506143" +datestamp = "1639611298" diff --git a/docroot/sites/all/modules/contrib/file_entity/file_entity.module b/docroot/sites/all/modules/contrib/file_entity/file_entity.module index 17139ffa..b4d9115d 100644 --- a/docroot/sites/all/modules/contrib/file_entity/file_entity.module +++ b/docroot/sites/all/modules/contrib/file_entity/file_entity.module @@ -1233,19 +1233,27 @@ function file_entity_file_formatter_file_field_settings($form, &$form_state, $se // formatter functions, but we are not working with a Field API field, so // set $field accordingly. Unfortunately, the API is for $settings to be // transferred via the $instance parameter, so we must mock it. - if (isset($field_formatter_info['module']) && ($function = ($field_formatter_info['module'] . '_field_formatter_settings_form')) && function_exists($function)) { - $field = NULL; - $mock_instance = array( - 'display' => array( - $view_mode => array( - 'type' => $field_formatter_type, - 'settings' => $settings, + if (isset($field_formatter_info['module'])) { + $function = $field_formatter_info['module'] . '_field_formatter_settings_form'; + if (function_exists($function)) { + // The formatter's first argument is expected to be a field definition + // with at least "type" and "bundles" elements. + $mock_field = array( + 'type' => NULL, + 'bundles' => array(), + ); + $mock_instance = array( + 'display' => array( + $view_mode => array( + 'type' => $field_formatter_type, + 'settings' => $settings, + ), ), - ), - 'entity_type' => 'file', - 'bundle' => $file_type, - ); - return $function($field, $mock_instance, $view_mode, $form, $form_state); + 'entity_type' => 'file', + 'bundle' => $file_type, + ); + return $function($mock_field, $mock_instance, $view_mode, $form, $form_state); + } } } } diff --git a/docroot/sites/all/modules/contrib/file_entity/file_entity.pages.inc b/docroot/sites/all/modules/contrib/file_entity/file_entity.pages.inc index c2b19539..c6a41257 100644 --- a/docroot/sites/all/modules/contrib/file_entity/file_entity.pages.inc +++ b/docroot/sites/all/modules/contrib/file_entity/file_entity.pages.inc @@ -384,7 +384,7 @@ function file_entity_usage_page($file) { // Determine all of the locations where a file is used, then loop through the // occurrences and filter out any duplicates. - foreach (file_usage_list($file) as $type) { + foreach (file_usage_list($file) as $module => $type) { foreach ($type as $entity_type => $entity_ids) { // There are cases where the actual entity doesn't exist. // We have to handle this. @@ -435,6 +435,11 @@ function file_entity_usage_page($file) { } } } + // For file_lock module, display relevant usage information. + elseif ($module == 'file_lock') { + $entity_label = t('File lock'); + $entity_id = '--'; + } else { $entity_label = check_plain($label); } @@ -1273,12 +1278,9 @@ function file_entity_get_upload_validators(array $options = array()) { $validators['file_validate_extensions'] = array(variable_get('file_entity_default_allowed_extensions', 'jpg jpeg gif png txt doc docx xls xlsx pdf ppt pptx pps ppsx odt ods odp mp3 mov mp4 m4a m4v mpeg avi ogg oga ogv weba webp webm')); } - // Cap the upload size according to the system or user defined limit. Note: In - // PHP 8 file_upload_max_size() returns a string instead of an integer, so - // cast it to an integer to avoid a critical error; do the same for the - // variable, just in case. - $max_filesize = parse_size(intval(file_upload_max_size())); - $file_entity_max_filesize = parse_size(intval(variable_get('file_entity_max_filesize', ''))); + // Cap the upload size according to the system or user defined limit. + $max_filesize = parse_size(file_upload_max_size()); + $file_entity_max_filesize = parse_size(variable_get('file_entity_max_filesize', '')); // If the user defined a size limit, use the smaller of the two. if (!empty($file_entity_max_filesize)) { diff --git a/docroot/sites/all/modules/contrib/file_entity/tests/file_entity_test.info b/docroot/sites/all/modules/contrib/file_entity/tests/file_entity_test.info index c3f91c16..da06003f 100644 --- a/docroot/sites/all/modules/contrib/file_entity/tests/file_entity_test.info +++ b/docroot/sites/all/modules/contrib/file_entity/tests/file_entity_test.info @@ -5,8 +5,8 @@ core = 7.x dependencies[] = file_entity hidden = TRUE -; Information added by Drupal.org packaging script on 2021-11-10 -version = "7.x-2.33" +; Information added by Drupal.org packaging script on 2021-12-15 +version = "7.x-2.35" core = "7.x" project = "file_entity" -datestamp = "1636506143" +datestamp = "1639611298"