You are here

function ddf_add_dependency in Dynamic dependent fields 7

1 call to ddf_add_dependency()
ddf_entityreference_field_update_field in modules/ddf_entityreference/ddf_entityreference.module
Implements hook_field_update_field().

File

./ddf.module, line 167

Code

function ddf_add_dependency($controlling_field_name, $dependent_field_name, $entity_type, $bundle, $settings = NULL) {
  $fields = array(
    'field_name' => $controlling_field_name,
    'entity_type' => $entity_type,
    'bundle' => $bundle,
    'dependent_field_name' => $dependent_field_name,
  );
  if (!is_null($settings)) {
    $fields['data'] = serialize($settings);
  }
  db_insert('ddf')
    ->fields($fields)
    ->execute();
}