You are here

function flag_handler_argument_content_id::title_query in Flag 7.2

Same name and namespace in other branches
  1. 6.2 includes/flag_handler_argument_content_id.inc \flag_handler_argument_content_id::title_query()
  2. 6 includes/flag_handler_argument_content_id.inc \flag_handler_argument_content_id::title_query()

Override the behavior of title(). Get the title of the appropriate objects.

Overrides views_handler_argument_numeric::title_query

File

includes/flag_handler_argument_content_id.inc, line 28
Contains the content ID argument handler.

Class

flag_handler_argument_content_id
Handler to accept an argument of the content ID of any object.

Code

function title_query() {
  if (!($flag = $this
    ->get_flag())) {
    return array();

    // Error message is printed by get_flag().
  }
  $views_info = $flag
    ->get_views_info();
  $titles = array();
  $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d'));
  $result = db_select($views_info['views table'], 'o')
    ->fields('o', array(
    $views_info['title field'],
  ))
    ->condition('o.' . $views_info['join field'], $this->value, 'IN')
    ->execute();
  foreach ($result as $title) {
    $titles[] = check_plain($title->{$views_info['title field']});
  }
  return $titles;
}