Browse Source

use link field title instead of node title for bestbet results

2.x
Paul Pound 1 year ago
parent
commit
32166bdddd
  1. 4
      modules/solr_site/src/Controller/RoblibSearchSolrsiteController.php

4
modules/solr_site/src/Controller/RoblibSearchSolrsiteController.php

@ -103,6 +103,10 @@ class RoblibSearchSolrsiteController extends ControllerBase {
$output['results'][$id]['type'] = reset($type); $output['results'][$id]['type'] = reset($type);
$urls = $result->getField('url')->getValues(); $urls = $result->getField('url')->getValues();
$output['results'][$id]['url'] = reset($urls); $output['results'][$id]['url'] = reset($urls);
if ($solr_type == 'BestBet') {
$entity = $result->getOriginalObject()->getValue();
$output['results'][$id]['title'] = $entity->field_link->first()->title;
}
$links = $result->getField('field_link')->getValues(); $links = $result->getField('field_link')->getValues();
$output['results'][$id]['field_link'] = empty($links) ? '' : $links; $output['results'][$id]['field_link'] = empty($links) ? '' : $links;
} }

Loading…
Cancel
Save