You are here

function party_user_party_acquisition_values_alter in Party 7

Implements hook_party_acquisition_values_alter().

Allow callers to indicate special user related behavior:

  • $context['party_user']['values_reference']: Set to TRUE to indicate that the value in $context['party_user']['values'] are references to the main acquire values.

File

modules/party_user/party_user.party_acquisition.inc, line 14

Code

function party_user_party_acquisition_values_alter(&$values, array &$context) {
  if (!empty($context['party_user']['values_reference'])) {

    // Loop over the user values and set them. If they don't exist remove them.
    foreach ($context['party_user']['values'] as $property => &$value) {
      if (isset($values[$value])) {
        $value = $values[$value];
      }
      else {
        unset($context['party_user']['values_reference'][$property]);
      }
    }
  }
  if (!empty($context['party_user']['fallback'])) {
    $context['original_behavior'] = $context['behavior'];
    $context['behavior'] = PartyAcquisitionInterface::BEHAVIOR_NOTHING;
  }
}