updated i18n, views, imagestyleflush, field_group
patch views_rss_media
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
CONTENTS OF THIS FILE
|
||||
---------------------
|
||||
|
||||
* Introduction
|
||||
* Requirements
|
||||
* Recommended modules
|
||||
* Installation
|
||||
* Configuration
|
||||
* Maintainers
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
------------
|
||||
|
||||
The Field translation module, part of the Internationalization
|
||||
(https://www.drupal.org/project/i18n) package, allows for translation of text
|
||||
associated with a field's settings including the label, help text, default
|
||||
value, and list options.
|
||||
|
||||
* For a full description of the module, visit this page
|
||||
https://www.drupal.org/node/1279346.
|
||||
|
||||
* To submit bug reports and feature suggestions, or to track changes visit
|
||||
https://www.drupal.org/project/issues/i18n.
|
||||
|
||||
|
||||
REQUIREMENTS
|
||||
------------
|
||||
|
||||
This module requires the following module:
|
||||
|
||||
* Internationalization - https://www.drupal.org/project/i18n
|
||||
|
||||
|
||||
RECOMMENDED MODULES
|
||||
-------------------
|
||||
|
||||
* Internationalization Views - https://www.drupal.org/project/i18nviews
|
||||
* Language Icons - https://www.drupal.org/project/languageicons
|
||||
* Translation Overview - https://www.drupal.org/project/translation_overview
|
||||
* Localization Client - https://www.drupal.org/project/l10n_client
|
||||
* Internationalization contributions -
|
||||
https://www.drupal.org/project/i18n_contrib
|
||||
|
||||
|
||||
INSTALLATION
|
||||
------------
|
||||
|
||||
This is a submodule of the Internationalization module. Install the
|
||||
Internationalization module as you would normally install a contributed Drupal
|
||||
module. Visit https://www.drupal.org/node/895232 for further information.
|
||||
|
||||
|
||||
CONFIGURATION
|
||||
-------------
|
||||
|
||||
1. Enable the Field translation module included with Internationalization.
|
||||
2. Go to Administration > Configuration > Regional and language > Translate
|
||||
interface.
|
||||
3. Select the Filter Translatable Strings field set and limit search to fields.
|
||||
4. Edit the desired field and Save.
|
||||
|
||||
For the translation to be displayed, the user needs to use some of the Field
|
||||
Formatters provided by this module whose name usually ends up in 'translated'.
|
||||
For most core fields it is Default translated.
|
||||
|
||||
Note: The Field Translation module does not provide content translation for
|
||||
fields. This functionality is provided by the Entity Translation (ET) module.
|
||||
|
||||
|
||||
MAINTAINERS
|
||||
-----------
|
||||
|
||||
* Jose Reyero - https://www.drupal.org/u/jose-reyero
|
||||
* Florian Weber (webflo) - https://www.drupal.org/u/webflo
|
||||
* Peter Philipp - https://www.drupal.org/u/das-peter
|
||||
* Joseph Olstad - https://www.drupal.org/u/joseph.olstad
|
||||
* Nathaniel Catchpole - https://www.drupal.org/u/catch
|
@@ -72,7 +72,7 @@ function i18n_field_i18n_string_info() {
|
||||
'description' => t('Configurable fields descriptions, defaults, options, etc.'),
|
||||
'format' => FALSE, // This group doesn't have formatted strings
|
||||
'list' => TRUE, // This group can list all strings
|
||||
'class' => 'i18n_string_textgroup_cached',
|
||||
'class' => variable_get('i18n_string_textgroup_class_field', 'i18n_string_textgroup_cached'),
|
||||
);
|
||||
return $groups;
|
||||
}
|
||||
|
@@ -6,9 +6,8 @@ package = Multilingual - Internationalization
|
||||
core = 7.x
|
||||
files[] = i18n_field.inc
|
||||
files[] = i18n_field.test
|
||||
; Information added by Drupal.org packaging script on 2015-05-07
|
||||
version = "7.x-1.13"
|
||||
; Information added by Drupal.org packaging script on 2018-08-17
|
||||
version = "7.x-1.26"
|
||||
core = "7.x"
|
||||
project = "i18n"
|
||||
datestamp = "1430999922"
|
||||
|
||||
datestamp = "1534531985"
|
||||
|
@@ -194,6 +194,9 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
|
||||
// Single-value file fields and image fields.
|
||||
$alter_element = &$element[0];
|
||||
}
|
||||
elseif ($field['type'] == 'url' && $field['module'] == 'url' && $field['cardinality'] == 1) {
|
||||
$alter_element = &$element;
|
||||
}
|
||||
elseif (isset($element['value'])) {
|
||||
// Number fields. Single-value text fields.
|
||||
$alter_element = &$element['value'];
|
||||
@@ -202,6 +205,10 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
|
||||
// Entityreference fields using the entityreference_autocomplete widget.
|
||||
$alter_element = &$element['target_id'];
|
||||
}
|
||||
elseif ($field['type'] == 'node_reference' && isset($element['nid'])) {
|
||||
// The node_reference fields using the entityreference_autocomplete widget.
|
||||
$alter_element = &$element['nid'];
|
||||
}
|
||||
else {
|
||||
// All other fields.
|
||||
$alter_element = &$element;
|
||||
@@ -446,3 +453,120 @@ function i18n_field_type_info($type = NULL, $property = NULL) {
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_info_alter().
|
||||
*/
|
||||
function i18n_field_field_info_alter(&$field_info) {
|
||||
foreach(array_keys($field_info) as $type) {
|
||||
$field_info[$type]['property_callbacks'][] = 'i18n_field_entity_property_callback';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prime the cache to avoid single db queries for entity fields / properties.
|
||||
*
|
||||
* This is mainly uses when large operations are occuring like a flush of the
|
||||
* entity_property_infos().
|
||||
*/
|
||||
function i18n_field_prime_caches() {
|
||||
global $language;
|
||||
static $cache_primed;
|
||||
|
||||
// Fill the cache. This should avoid single db queries when filling the
|
||||
// properties.
|
||||
if (empty($cache_primed)) {
|
||||
$cache_primed = TRUE;
|
||||
$text_group = i18n_string_textgroup('field');
|
||||
// Load all strings at once to avoid callbacks for each individual string.
|
||||
$text_group->load_strings();
|
||||
$text_group->multiple_translation_search(array('type' => '*', 'objectid' => '*', 'property' => '*'), $language->language);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to translate entity property info for a fields.
|
||||
*
|
||||
* @see entity_metadata_field_entity_property_info()
|
||||
* @see entity_metadata_field_default_property_callback()
|
||||
* @see i18n_field_i18n_object_info_alter()
|
||||
* @see hook_module_implements_alter()
|
||||
*/
|
||||
function i18n_field_entity_property_callback(&$info, $entity_type, $field, $instance, $field_type) {
|
||||
global $language;
|
||||
|
||||
// This could create a endless recursion if it's called during rebuilding the
|
||||
// cache for i18n_object_info(). So if the cache of i18n_object_info isn't
|
||||
// available yet we assume the worst case, leave the info alone but trigger a
|
||||
// rebuild of the property when hook_i18n_object_info_alter is invoked. At
|
||||
// that point the info is available and we can rely on it.
|
||||
if (!$info = &drupal_static('i18n_object_info')) {
|
||||
$i18n_field_entity_property_callback_fallback = &drupal_static(__FUNCTION__);
|
||||
$i18n_field_entity_property_callback_fallback = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
i18n_field_prime_caches();
|
||||
$name = $field['field_name'];
|
||||
$property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
|
||||
$property['label'] = i18n_field_translate_property($instance, 'label', $language->language);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_object_info_alter().
|
||||
*/
|
||||
function i18n_field_i18n_object_info_alter(&$info) {
|
||||
if (drupal_static('i18n_field_entity_property_callback')) {
|
||||
if ($info = drupal_static('i18n_object_info')) {
|
||||
// Clean static and permanent cache of the data and then re-run the property
|
||||
// building.
|
||||
// Use a lock to avoid stampeding.
|
||||
$lock_name = 'i18n_field_entity_property_callback_fallback:' . $GLOBALS['language']->language;
|
||||
// See if another request is already doing this. If so we bail out here as
|
||||
// we won't help with anything at the moment.
|
||||
if (!lock_may_be_available($lock_name)) {
|
||||
return;
|
||||
}
|
||||
if (lock_acquire($lock_name)) {
|
||||
i18n_field_prime_caches();
|
||||
// Inject translated properties.
|
||||
$entity_property_info = entity_get_property_info();
|
||||
foreach ($entity_property_info as $entity_type => $properties) {
|
||||
if (isset($properties['bundles'])) {
|
||||
foreach ($properties['bundles'] as $bundle => $bundle_properties) {
|
||||
if ($bundle_properties['properties']) {
|
||||
foreach ($bundle_properties['properties'] as $bundle_property => $bundle_property_info) {
|
||||
if ($instance = field_info_instance($entity_type, $bundle_property, $bundle)) {
|
||||
$property = &$entity_property_info[$entity_type]['bundles'][$instance['bundle']]['properties'][$bundle_property];
|
||||
$property['label'] = i18n_field_translate_property($instance, 'label', $GLOBALS['language']->language);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Inject into static cache.
|
||||
$entity_get_property_info = &drupal_static('entity_get_property_info', array());
|
||||
$entity_get_property_info = $entity_property_info;
|
||||
// Write permanent cache.
|
||||
cache_set('entity_property_info:' . $GLOBALS['language']->language, $entity_property_info);
|
||||
lock_release($lock_name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
watchdog('i18n_field', 'Unable to run fall-back handling for entity property translation due missing "i18n_object_info" cache', array(), WATCHDOG_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_module_implements_alter().
|
||||
*/
|
||||
function i18n_field_module_implements_alter(&$implementations, $hook) {
|
||||
if ($hook == 'i18n_object_info_alter') {
|
||||
// Move our hook implementation to the bottom.
|
||||
$group = $implementations['i18n_field'];
|
||||
unset($implementations['i18n_field']);
|
||||
$implementations['i18n_field'] = $group;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user