$tableResult) { $section = ''; $table = Cake\ORM\TableRegistry::get($tableName); $fieldPath = !empty($table->getDisplayField()) ? $table->getDisplayField() : 'id'; $section .= sprintf(' %s
', h($tableName)); foreach ($tableResult as $entry) { $section .= sprintf('%s', Cake\Routing\Router::URL([ 'controller' => Cake\Utility\Inflector::pluralize($entry->getSource()), 'action' => 'view', h($entry['id']) ]), h($entry[$fieldPath]) ); } $sections[] = $section; } if (!empty($sections)) { echo implode('', $sections); } else { echo sprintf('%s', __('- No result -')); }