You are here

function conditional_fields_dependency_load in Conditional Fields 7.3

Menu argument loader: loads a dependency from the database.

Parameters

$id: The dependency ID.

Return value

A fully populated dependency array, complete with its conditions, or FALSE if the dependency is not found.

File

./conditional_fields.module, line 1362
Define dependencies between fields based on their states and values.

Code

function conditional_fields_dependency_load($id) {
  $result = db_select('conditional_fields', 'cf')
    ->fields('cf', array(
    'id',
    'dependee',
    'dependent',
    'options',
  ))
    ->condition('id', $id)
    ->execute()
    ->fetchAssoc();
  if (!$result) {
    return FALSE;
  }
  $result['options'] = unserialize($result['options']) + conditional_fields_dependency_default_options();
  return $result;
}