You are here

function hook_social_content_import_alter in Social Content 7.2

Alter the entity before it's saved.

You have the original record so you can grab fields from it and attach it to the wrapper.

Parameters

EntityMetadataWrapper $wrapper: The EntityMetadataWrapper with the fields in the settings set.

object $context: The original record from the social network.

1 invocation of hook_social_content_import_alter()
SocialContent::import in ./social_content.class.inc
Do the import.

File

./social_content.api.php, line 82
Hooks provided by Social Content module

Code

function hook_social_content_import_alter(&$wrapper, &$context) {
  $settings = $context['settings'];
  if (isset($settings['contest']) && !empty($settings['contest'])) {
    $wrapper->field_contest
      ->set($settings['contest']);
    $wrapper->field_terms
      ->set(array(
      1,
    ));
  }
}