1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 00:37:02 +02:00
This commit is contained in:
Ryan Cramer
2017-12-05 12:15:23 -05:00
parent 5b8761454a
commit fb21af434d

View File

@@ -798,11 +798,16 @@ abstract class FieldtypeMulti extends Fieldtype {
}
// only allow matches using templates with the requested field
$sql = 'pages.templates_id IN(';
foreach($field->getTemplates() as $template) {
$sql .= ((int) $template->id) . ',';
$templates = $field->getTemplates();
if(count($templates)) {
$sql = 'pages.templates_id IN(';
foreach($templates as $template) {
$sql .= ((int) $template->id) . ',';
}
$sql = rtrim($sql, ',') . ')';
} else {
$sql = 'pages.templates_id=0';
}
$sql = rtrim($sql, ',') . ')';
$query->where($sql); // QA
} else {