You are here

function feeds_entity_processor_plugin in Feeds entity processor 7

Gets an instance of a class for a given plugin.

Parameters

string $name: A string that is the key of the plugin to load.

array $property: The info about the property.

EntityMetadataWrapper $wrapper: Metadata about the entity being created/updated.

FeedsProcessor $processor: The Feeds processor that is processing.

Return value

FeedsEntityProcessorPropertyInterface A FeedsPlugin object.

Throws

RuntimeException In case a class for the default plugin could not be found.

5 calls to feeds_entity_processor_plugin()
FeedsEntityProcessor::configForm in src/FeedsEntityProcessor.inc
Overrides parent::configForm().
FeedsEntityProcessor::configFormValidate in src/FeedsEntityProcessor.inc
Overrides parent::configFormValidate().
FeedsEntityProcessor::getMappingTargets in src/FeedsEntityProcessor.inc
Overrides parent::getMappingTargets().
FeedsEntityProcessor::newEntity in src/FeedsEntityProcessor.inc
Implements FeedsProcessor::newEntity().
FeedsEntityProcessor::setTargetElement in src/FeedsEntityProcessor.inc

File

./feeds_entity_processor.module, line 59
Provides a generic entity processor for Feeds.

Code

function feeds_entity_processor_plugin($name, array $property, EntityMetadataWrapper $wrapper, FeedsProcessor $processor) {
  ctools_include('plugins');
  $type = !empty($property['type']) ? $property['type'] : 'default';
  if ($class = ctools_plugin_load_class('feeds_entity_processor', 'properties', $type, 'handler')) {
    return new $class($name, $property, $wrapper, $processor);
  }
  $class = ctools_plugin_load_class('feeds_entity_processor', 'properties', 'default', 'handler');
  if (!$class) {
    throw new RuntimeException('Default Feeds entity processor properties handler not found. Please flush caches and try again.');
  }
  return new $class($name, $property, $wrapper, $processor);
}