'; } foreach ($data as $tableName => $tableResult) { if (empty($tableResult['amount'])) { continue; } $section = ''; $table = Cake\ORM\TableRegistry::get($tableName); $fieldPath = !empty($table->getDisplayField()) ? $table->getDisplayField() : 'id'; $section .= sprintf(' %s
%s
', h($tableName), $tableResult['amount']); foreach ($tableResult['entries'] as $entry) { if ($entry->getSource() == 'MetaFields') { $section .= sprintf('%s', Cake\Routing\Router::URL([ 'controller' => Cake\Utility\Inflector::pluralize($entry->scope), 'action' => 'view', h($entry->parent_id) ]), sprintf('%s (%s::%s)', h($entry->value), h($entry->scope), h($entry->field)) ); } else { $section .= sprintf('%s', Cake\Routing\Router::URL([ 'controller' => Cake\Utility\Inflector::pluralize($entry->getSource()), 'action' => 'view', h($entry['id']) ]), h($entry[$fieldPath]) ); } } $remaining = $tableResult['amount'] - count($tableResult['entries']); if ($remaining > 0) { $section .= sprintf('%s %s%s', Cake\Routing\Router::URL([ 'controller' => 'instance', 'action' => 'search_all', '?' => [ 'model' => h($tableName), 'search' => h($this->request->getParam('?')['search'] ?? ''), 'show_all' => 1 ] ]), __('Load'), $remaining, __('more results') ); } $sections[] = $section; } if (!empty($ajax)) { $sections[] = sprintf('%s', Cake\Routing\Router::URL([ 'controller' => 'instance', 'action' => 'search_all', '?' => [ 'search' => h($this->request->getParam('?')['search'] ?? '') ] ]), $this->FontAwesome->getClass('search-plus'), __('View all results') ); $sections[] = ''; } else { echo sprintf('

%s %s

', __('Global search results for:'), h($this->request->getParam('?')['search'] ?? '')); } if (!empty($sections)) { echo implode('', $sections); } else { echo sprintf('%s', __('- No result -')); }