You are here

function PMPAPIDrupalPull::getDefaultFieldValue in Public Media Platform API Integration 7

Finds the default value of a given field instance.

Parameters

$entity object: The Drupal entity to which the field is attached

$entity_type string: The type of the entity

$bundle_name: The type of bundle of the entity

$field string: The name of the field whose default value will be determined

Return value

array The default value(s) of the field

1 call to PMPAPIDrupalPull::getDefaultFieldValue()
PMPAPIDrupalPull::saveEntity in pmpapi_pull/classes/PMPAPIDrupalPull.php
Saves a PMP doc as an entity.

File

pmpapi_pull/classes/PMPAPIDrupalPull.php, line 520
Contains PMPAPIDrupalPull.

Class

PMPAPIDrupalPull
Turns PMP hypermedia docs in Drupal entities.

Code

function getDefaultFieldValue($entity, $entity_type, $bundle_name, $field) {
  $field_info = field_info_field($field);
  $instance = field_info_instance($entity_type, $field, $bundle_name);
  $value = field_get_default_value($entity_type, $entity, $field, $instance, $entity->language);
  return $value;
}