updated admin_menu, entity_translation, addressfield, addressfield_token, autocomplete_deluxe

This commit is contained in:
2019-05-13 17:41:56 +02:00
parent 472762edfa
commit 33210e10f2
65 changed files with 3124 additions and 700 deletions
@@ -36,10 +36,20 @@ function addressfield_feeds_processor_targets_alter(&$targets, $entity_type, $bu
* A string identifying the target on the node.
* @param $values
* The value to populate the target with.
* @param array $mapping
* Associative array of the mapping settings from the per mapping
* configuration form.
*/
function addressfield_set_target($source, $entity, $target, $values) {
function addressfield_set_target($source, $entity, $target, $values, $mapping) {
$language = $mapping['language'];
list($field_name, $sub_field) = explode(':', $target, 2);
// Field info and instance are required for setting default values.
$entity_type = $source->importer->processor->entityType();
list(, , $bundle_name) = entity_extract_ids($entity_type, $entity);
$info = field_info_field($field_name);
$instance = field_info_instance($entity_type, $field_name, $bundle_name);
// Convert the values into an array if it isn't one already to correspond to
// Drupal's handling of field value arrays.
if (!is_array($values)) {
@@ -48,12 +58,16 @@ function addressfield_set_target($source, $entity, $target, $values) {
// If the field is already set on the given entity, update the existing value
// array. Otherwise start with a fresh field value array.
$field = isset($entity->$field_name) ? $entity->$field_name : array();
$field = isset($entity->{$field_name}) ? $entity->{$field_name} : array();
// Loop over the field values array...
foreach ($values as $delta => $value) {
$field[LANGUAGE_NONE][$delta][$sub_field] = $value;
// Set defaults for new values.
if (!isset($field[$language][$delta])) {
$field[$language][$delta] = addressfield_default_values($info, $instance);
}
$field[$language][$delta][$sub_field] = $value;
}
$entity->$field_name = $field;
$entity->{$field_name} = $field;
}