You are here

function party_hat_field_get_default in Party 8.2

Same name and namespace in other branches
  1. 7 modules/party_hat/party_hat.module \party_hat_field_get_default()

Get Required Hats for Field Values

2 string references to 'party_hat_field_get_default'
party_hat_install in modules/party_hat/party_hat.install
Implements hook_install().
party_hat_update_7001 in modules/party_hat/party_hat.install
Drop Party Bundles - migrate hat fields.

File

modules/party_hat/party_hat.module, line 661
party_hat.module Provides an extensible access system for parties.

Code

function party_hat_field_get_default($entity_type, $entity, $field, $instance, $langcode = NULL) {

  //only works for party at the moment.
  if ($entity_type != 'party') {
    return array();
  }

  //Get required hats.
  $options = array(
    'required' => TRUE,
  );
  $hats = party_hat_get_all_hats($options);
  $values = array();
  foreach ($hats as $hat) {
    $values[] = array(
      'hat_name' => $hat->name,
    );
  }
  return $values;
}