You are here

function party_set_data_set_value in Party 7

Set a value to a property or field on a data set.

Parameters

Party $party: The party to find a value for.

mixed $value: The value to set.

string $data_set_name: The data set name we're pulling from.

string $column: The column to retrieve. This can be a column of a field or a property depending on whether $field_name was given.

string $field_name: (optional) A field name. If not provided, $column will be treated as a property of the entity.

1 call to party_set_data_set_value()
party_user_email_sync in modules/party_user/party_user.module
Synchronise the user email into all relevant fields.

File

./party.module, line 1665
Provides a generic CRM party entity.

Code

function party_set_data_set_value($party, $value, $data_set_name, $column, $field_name = NULL) {
  $controller = $party
    ->getDataSetController($data_set_name);
  if ($entity = $controller
    ->getEntity(0, TRUE)) {
    if ($field_name) {
      $entity->{$field_name}[LANGUAGE_NONE][0][$column] = $value;
    }
    else {
      $entity->{$column} = $value;
    }
    $controller
      ->save(TRUE);
  }
}