Commit b2dc7f5f authored by fubhy's avatar fubhy Committed by fago

Issue #1996154 by fubhy: Added Allow entities to define the data type of their machine name.

parent 028b66fa
......@@ -251,7 +251,11 @@ function entity_property_verify_data_type($data, $type) {
return TRUE;
}
elseif (isset($info[$type]['entity keys']['name'])) {
return entity_property_verify_data_type($data, 'token');
// Read the data type of the name key from the metadata if available.
$key = $info[$type]['entity keys']['name'];
$property_info = entity_get_property_info($type);
$property_type = isset($property_info['properties'][$key]['type']) ? $property_info['properties'][$key]['type'] : 'token';
return entity_property_verify_data_type($data, $property_type);
}
return entity_property_verify_data_type($data, empty($info[$type]['fieldable']) ? 'text' : 'integer');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment