function microdata_get_value_type in Microdata 7
Translate Entity API property types into microdata property value types. The Entity API data types are documented at http://drupal.org/node/905580.
2 calls to microdata_get_value_type()
- microdata_field_attach_view_alter in ./
microdata.module - Implements hook_field_attach_view_alter().
- _microdata_prepare_mapping in ./
microdata.module - Helper function to prepare a microdata mapping for use.
File
- ./
microdata.module, line 850
Code
function microdata_get_value_type($type = 'no_type') {
$microdata_value_types =& drupal_static(__FUNCTION__);
// Ensure that this has been converted from Entity API's type string.
$type = _microdata_get_field_type($type);
if (!isset($microdata_value_types)) {
// Set the basic Entity Property API data types.
$microdata_value_types = array(
'text' => 'text',
'integer' => 'text',
'decimal' => 'text',
'uri' => 'url',
'field_item_image' => 'url',
'date' => 'datetime',
// Entity module types.
// Text property with summary.
'field_item_textsummary' => 'text',
// Properties with enabled text processing.
'text_formatted' => 'text',
);
// Add the entities.
foreach (array_keys(entity_get_info()) as $entity_type) {
$microdata_value_types[$entity_type] = 'item_reference';
}
// Allow modules to alter the value type. For example, some compound fields
// like addressfield would be assigned a value type of struct based on
// their Entity Property API data type, but should be handled as items
// instead.
drupal_alter('microdata_value_types', $microdata_value_types);
}
$type = isset($microdata_value_types[$type]) ? $microdata_value_types[$type] : NULL;
return $type;
}