You are here

function hook_feeds_prevalidate in Feeds 7.2

Invoked before a feed item is validated.

Parameters

FeedsSource $source: FeedsSource object that describes the source that is being imported.

object $entity: The entity object.

array $item: The parser result for this entity.

int|null $entity_id: The id of the current item which is going to be updated. If this is a new item, then NULL is passed.

Related topics

2 functions implement hook_feeds_prevalidate()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

feeds_tests_feeds_prevalidate in tests/feeds_tests.feeds.inc
Implements hook_feeds_prevalidate().
og_feeds_prevalidate in mappers/og.inc
Implements hook_feeds_prevalidate().
1 invocation of hook_feeds_prevalidate()
FeedsProcessor::process in plugins/FeedsProcessor.inc
Process the result of the parsing stage.

File

./feeds.api.php, line 160
Documentation of Feeds hooks.

Code

function hook_feeds_prevalidate(FeedsSource $source, $entity, $item, $entity_id) {

  // Correct a field value to make it pass validation.
  if (isset($entity->myfield)) {
    foreach ($entity->myfield as $language => &$values) {

      // There are only three values allowed. Throw away the rest.
      if (count($values) > 3) {
        $values = array_slice($values, 0, 3);
      }
    }
  }
}