public static function FeedImport::getEntityInfo in Feed Import 7
Same name and namespace in other branches
- 7.3 feed_import_base/inc/feed_import.inc \FeedImport::getEntityInfo()
- 7.2 feed_import.inc.php \FeedImport::getEntityInfo()
Gets info about entities and fields
Parameters
string $entity: Entity name
Return value
array Info about entities
5 calls to FeedImport::getEntityInfo()
- feed_import_add_new_feed_form in ./
feed_import.module - Add a new feed form
- feed_import_add_new_feed_form_submit in ./
feed_import.module - Add new feed form submit
- feed_import_edit_feed_form in ./
feed_import.module - Edit feed form
- feed_import_edit_feed_form_submit in ./
feed_import.module - Edit feed form submit
- feed_import_entity_delete in ./
feed_import.module - Implements hook_entity_delete().
File
- ./
feed_import.inc.php, line 119 - Feed import class for parsing and processing content
Class
- FeedImport
- @file Feed import class for parsing and processing content
Code
public static function getEntityInfo($entity = NULL) {
$fields = variable_get('feed_import_entity_info', array());
$expired = variable_get('feed_import_entity_info_expire', 0) < REQUEST_TIME;
if ($expired || empty($fields)) {
$info = array();
$fields = _field_info_collate_fields(FALSE);
if (isset($fields['fields'])) {
$fields = $fields['fields'];
}
foreach ($fields as &$field) {
$info[$field['field_name']] = array(
'name' => $field['field_name'],
'column' => key($field['columns']),
'bundles' => array_keys($field['bundles']),
);
$field = NULL;
}
$fields = entity_get_info();
foreach ($fields as $key => &$field) {
$field = array(
'name' => $key,
'column' => $field['entity keys']['id'],
'columns' => $field['schema_fields_sql']['base table'],
);
$field['columns'] = array_flip($field['columns']);
foreach ($field['columns'] as &$f) {
$f = NULL;
}
foreach ($info as &$f) {
if (!in_array($key, $f['bundles'])) {
continue;
}
$field['columns'][$f['name']] = $f['column'];
}
}
unset($info);
variable_set('feed_import_entity_info', $fields);
variable_set('feed_import_entity_info_expire', REQUEST_TIME + variable_get('feed_import_entity_info_keep', 3600));
}
if (!$entity) {
return $fields;
}
else {
return isset($fields[$entity]) ? $fields[$entity] : NULL;
}
}