$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) {
$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')
);
} else {
echo sprintf('