You are here

function feeds_entity_property_info_alter in Feeds 8.2

Same name and namespace in other branches
  1. 7.2 feeds.module \feeds_entity_property_info_alter()

Implements hook_entity_property_info_alter().

File

./feeds.module, line 1116
Feeds - basic API functions and hook implementations.

Code

function feeds_entity_property_info_alter(&$info) {

  // Gather entities supported by Feeds processors.
  $processors = FeedsPlugin::byType('processor');
  $supported_entities = array();
  foreach ($processors as $processor) {
    $instance = feeds_plugin($processor['handler']['class'], '__none__');
    if (method_exists($instance, 'entityType')) {
      $supported_entities[] = $instance
        ->entityType();
    }
  }

  // Feeds processors can fake the entity info. Only set the property for
  // defined entities.
  $supported_entities = array_intersect(array_keys($info), $supported_entities);
  foreach ($supported_entities as $entity_type) {
    $info[$entity_type]['properties']['feed_nid'] = array(
      'label' => 'Feed NID',
      'type' => 'integer',
      'description' => t('Nid of the Feed Node that imported this entity.'),
      'getter callback' => 'feeds_get_feed_nid_entity_callback',
    );
  }
}