function mailchimp_activity_email_fieldmap_options in Mailchimp 7.5
Same name and namespace in other branches
- 7.2 modules/mailchimp_activity/mailchimp_activity.admin.inc \mailchimp_activity_email_fieldmap_options()
- 7.3 modules/mailchimp_activity/includes/mailchimp_activity.admin.inc \mailchimp_activity_email_fieldmap_options()
- 7.4 modules/mailchimp_activity/includes/mailchimp_activity.admin.inc \mailchimp_activity_email_fieldmap_options()
Return all possible Drupal properties for a given entity type.
Parameters
string $entity_type: Name of entity whose properties to list.
string $entity_bundle: Optional entity bundle to get properties for.
Return value
array List of entities that can be used as an #options list.
1 call to mailchimp_activity_email_fieldmap_options()
- mailchimp_activity_entity_form in modules/
mailchimp_activity/ includes/ mailchimp_activity.admin.inc - Returns a form for a mailchimp_activity_entity.
File
- modules/
mailchimp_activity/ includes/ mailchimp_activity.admin.inc, line 205 - Administration pages for mailchimp_activity module.
Code
function mailchimp_activity_email_fieldmap_options($entity_type, $entity_bundle = NULL) {
$options = array(
'' => t('-- Select --'),
);
$properties = entity_get_all_property_info($entity_type);
if (isset($entity_bundle)) {
$info = entity_get_property_info($entity_type);
$properties = $info['properties'];
if (isset($info['bundles'][$entity_bundle])) {
$properties += $info['bundles'][$entity_bundle]['properties'];
}
}
foreach ($properties as $key => $property) {
$type = isset($property['type']) ? entity_property_extract_innermost_type($property['type']) : 'text';
$is_entity = $type == 'entity' || (bool) entity_get_info($type);
// Leave entities out of this.
if (!$is_entity) {
if (isset($property['field']) && $property['field'] && !empty($property['property info'])) {
foreach ($property['property info'] as $sub_key => $sub_prop) {
$options[$property['label']][$key . ':' . $sub_key] = $sub_prop['label'];
}
}
else {
$options[$key] = $property['label'];
}
}
}
return $options;
}