You are here

function party_property_has_dataset_get in Party 7

Callback for getting has attached entity property values.

See also

entity_metadata_field_property_get().

1 string reference to 'party_property_has_dataset_get'
party_entity_property_info_alter in ./party.info.inc
Implements hook_entity_property_info_alter().

File

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

Code

function party_property_has_dataset_get($party, array $options, $property_name, $entity_type, $info) {

  // Check that property is prefixed with 'has_dataset'.
  if (substr($property_name, 0, 11) != 'has_dataset') {
    return FALSE;
  }

  // Remove the 'has_dataset_' from the front of the property name.
  $data_set_name = substr($property_name, 12);
  $data_set_ids = $party
    ->getDataSetController($data_set_name)
    ->getEntityIds();

  // Return TRUE/FALSE base on the outcome of the getEntityIds().
  return $data_set_ids ? TRUE : FALSE;
}