function field_validation_get_field_rules in Field Validation 7
Get an array of rules assigned to a field instance
1 call to field_validation_get_field_rules()
- field_validation_field_delete in ./
field_validation.module - Implements hook_field_delete().
File
- ./
field_validation.rules.inc, line 20 - provides API and management functions for the field validation rules
Code
function field_validation_get_field_rules($instance) {
$rules = array();
$bundle = $instance['bundle'];
$entity_type = $instance['entity_type'];
$field_name = $instance['field_name'];
$sql = "SELECT * FROM {field_validation_rule} WHERE field_name = :field_name AND entity_type = :entity_type AND bundle = :bundle ORDER BY ruleid DESC";
$result = db_query($sql, array(
':field_name' => $field_name,
':entity_type' => $entity_type,
':bundle' => $bundle,
), array(
'fetch' => PDO::FETCH_ASSOC,
));
foreach ($result as $rule) {
$rules[$rule['ruleid']] = $rule;
}
return $rules;
}