public static function FeedImport::getEntityInfo in Feed Import 7.2
Same name and namespace in other branches
- 7.3 feed_import_base/inc/feed_import.inc \FeedImport::getEntityInfo()
- 7 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 118 - 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) {
static $fields = NULL;
if (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) {
if (empty($field['schema_fields_sql']['base table']) || !is_array($field['schema_fields_sql']['base table']) || empty($field['entity keys']['id'])) {
unset($fields[$key]);
continue;
}
$field = array(
'name' => $key,
'column' => $field['entity keys']['id'],
'columns' => $field['schema_fields_sql']['base table'],
);
$field['columns'] = array_combine($field['columns'], array_fill(0, count($field['columns']), NULL));
foreach ($info as &$f) {
if (in_array($key, $f['bundles'])) {
$field['columns'][$f['name']] = $f['column'];
}
}
}
unset($info);
}
if (!$entity) {
return $fields;
}
else {
return isset($fields[$entity]) ? $fields[$entity] : NULL;
}
}