You are here

public static function PartyPrimaryFields::getSource in Party 7

Get the info of a particular source.

Parameters

string|array $source: Either a data set name or a partial source info array for the required source. See PartyPrimaryFields::$sources for the data structure. 'data_set' and 'property' are required.

string $property: Optionally provide a property to retrieve the source info for. $data_set is required if $property is given. Only used if $source is a data set string.

string $value: Optionally provide a value on a property to retrieve the source info for. $property is required if $value is given. Only used if $source is a data set string.

Return value

FALSE||array The full source info for the given partial source or FALSE if not available.

2 calls to PartyPrimaryFields::getSource()
PartyPrimaryFields::executeCallback in includes/party.primary_fields.inc
Execute a callback on a value.
PartyPrimaryFields::sourceForm in includes/party.primary_fields.inc
Set up a source form under the given element.

File

includes/party.primary_fields.inc, line 243
Primary field related functions and callbacks.

Class

PartyPrimaryFields
Helper class for primary fields.

Code

public static function getSource($source, $property = NULL, $value = NULL) {
  if (is_string($source)) {
    $source = array(
      'data_set' => $source,
      'property' => $property,
      'value' => $value,
    );
  }

  // Get hold of sources on the data set.
  $sources = self::getSources($source['data_set']);
  if (!$sources) {
    return FALSE;
  }

  // Build our key for returning the source info.
  $key = self::getSourceKey($source);
  return isset($sources[$key]) ? $sources[$key] : FALSE;
}