You are here

public static function PartyPrimaryFields::getPropertyInfo in Party 7

Retrieve property information for a specific entity/bundle.

Parameters

string $entity_type: The entity type we want information for.

string $bundle: The bundle we want information for.

string $property: Optionally only return information for a specific proprety.

Return value

FALSE|array FALSE if the requested information is not available. If $property is given, the metadata for that property, otherwise an array of property metadata keyed by property.

5 calls to PartyPrimaryFields::getPropertyInfo()
PartyPrimaryFields::buildFields in includes/party.primary_fields.inc
Build the primary field information.
PartyPrimaryFields::buildSources in includes/party.primary_fields.inc
Build the primary field source information.
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.
party_field_extra_fields in ./party.module
Implements hook_field_extra_fields().

File

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

Class

PartyPrimaryFields
Helper class for primary fields.

Code

public static function getPropertyInfo($entity_type, $bundle, $property = NULL) {
  $entity = entity_create_stub_entity($entity_type, array(
    0 => NULL,
    2 => $bundle,
  ));
  $wrapper = entity_metadata_wrapper($entity_type, $entity);
  $info = array();
  foreach (array_keys($wrapper
    ->getPropertyInfo()) as $key) {
    $info[$key] = $wrapper
      ->getPropertyInfo($key);
  }
  if ($property) {
    return isset($info[$property]) ? $info[$property] : FALSE;
  }
  else {
    return $info;
  }
}