You are here

function _features_actions_triggers_triggers_save_field in Features Actions Triggers 7

Saves a action field to the database.

Parameters

array $field_data: The field data to save.

1 call to _features_actions_triggers_triggers_save_field()
features_actions_triggers_triggers_features_revert in ./features_actions_triggers_triggers.features.inc
Implements hook_features_revert().

File

./features_actions_triggers_triggers.features.inc, line 73
Enable triggers to be exported by features.

Code

function _features_actions_triggers_triggers_save_field($field_data) {

  // Force field data to be an object.
  $field_data = (object) $field_data;

  // Check if record already exists.
  if (!db_query('SELECT * FROM {trigger_assignments} WHERE hook = :hook AND aid = :aid', array(
    ':hook' => $field_data->hook,
    ':aid' => $field_data->aid,
  ))
    ->fetchObject()) {
    drupal_write_record('trigger_assignments', $field_data);
  }
  else {
    drupal_write_record('trigger_assignments', $field_data, array(
      'hook',
      'aid',
    ));
  }
}