You are here

function Notifications_Field::get_value_condition in Notifications 7

Get query condition for a given value

Parameters

$value: Single value or array of values for this field

$alias: Alias of the notifications_subscription_fields table

2 calls to Notifications_Field::get_value_condition()
Notifications_Field::get_query_condition in ./notifications.field.inc
Get query condition for current value
Notifications_Node_Field::get_object_condition in ./notifications.field.inc
Get query condition for nodes

File

./notifications.field.inc, line 154
Drupal Notifications Framework - Default class file

Class

Notifications_Field
Base class for Notifications fields

Code

function get_value_condition($value, $alias = 'f') {
  $and = db_and();
  $and
    ->condition($alias . '.type', $this->type);
  if (isset($this->position)) {
    $and
      ->condition($alias . '.position', $this->position);
  }
  if ($this->data_type == 'int') {
    $value = is_array($value) ? array_map('intval', $value) : (int) $value;
    $and
      ->condition($alias . '.intval', $value);
  }
  else {
    $and
      ->condition($alias . '.value', $value);
  }
  return $and;
}