Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295277

getPreparedFieldMapping() should return NULL when there are no mappings

$
0
0

Updated: Comment #N

Problem/Motivation

When calling getPreparedFieldMapping() for a field which has no mappings defined in config, getPreparedFieldMapping() return an array like this:

<?php
array(4) {
  [
"properties"]=>
 
NULL
 
["datatype"]=>
 
NULL
 
["datatype_callback"]=>
 
NULL
 
["mapping_type"]=>
 
NULL
}
?>

Proposed resolution

If $field_mapping['properties'] is empty, there is really no reason to return that array of empty keys. getPreparedFieldMapping() should check if $field_mapping['properties'] is empty and return NULL if so, like getFieldMapping().

Remaining tasks

patch

User interface changes

NA

API changes

The return value will have to be adjusted in the docs.


Viewing all articles
Browse latest Browse all 295277

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>