plugin('translate'); // Prepare the property queries. $properties = isset($query['property']) ? $query['property'] : []; $properties = array_filter($properties, function ($value) { return isset($value['text']) ? '' !== trim($value['text']) : true; }); if (!$properties) { $properties[] = []; } if (isset($query['search'])) { unset($properties[0]['joiner']); array_unshift($properties, [ 'property' => '', 'type' => 'in', 'text' => $query['search'] ]); } $queryOption = function($value, array $search, $key, $text) { $selected = null; if (isset($search[$key]) && $value === $search[$key]) { $selected = ' selected'; } return sprintf('', $value, $selected, $text); }; $queryText = function(array $search, $index) { $text = isset($search['text']) ? $search['text'] : null; return sprintf('', $this->escapeHtml("property[$index][text]"), $this->escapeHtml($text), $this->escapeHtml($this->translate('Query text'))); } ?>