/** * Override the behavior of title(). Get the title of the support ticket. */ public function titleQuery() { $titles = array(); $support_tickets = $this->supportTicketStorage->loadMultiple($this->value); foreach ($support_tickets as $support_ticket) { $titles[] = SafeMarkup::checkPlain($support_ticket->label()); } return $titles; }
public function preRender($values) { $stids = array(); foreach ($values as $row) { $stids[] = $row->{$this->field_alias}; } if (!empty($stids)) { $this->support_tickets = $this->supportTicketStorage->loadMultiple($stids); } }
/** * Override the behavior of title(). Get the title of the revision. */ public function titleQuery() { $titles = array(); $results = $this->database->query('SELECT nr.vid, nr.stid, npr.title FROM {support_ticket_revision} nr WHERE nr.vid IN ( :vids[] )', array(':vids[]' => $this->value))->fetchAllAssoc('vid', PDO::FETCH_ASSOC); $stids = array(); foreach ($results as $result) { $stids[] = $result['stid']; } $support_tickets = $this->supportTicketStorage->loadMultiple(array_unique($stids)); foreach ($results as $result) { $support_tickets[$result['stid']]->set('title', $result['title']); $titles[] = SafeMarkup::checkPlain($support_tickets[$result['stid']]->label()); } return $titles; }