Exemple #1
0
 /**
  * Displaying search results.
  *
  * @param \core_search\document Containing a single search response to be displayed.a
  * @return string HTML
  */
 public function render_result(\core_search\document $doc)
 {
     $docdata = $doc->export_for_template($this);
     // Limit text fields size.
     $docdata['title'] = shorten_text($docdata['title'], static::SEARCH_RESULT_STRING_SIZE, true);
     $docdata['content'] = $docdata['content'] ? shorten_text($docdata['content'], static::SEARCH_RESULT_TEXT_SIZE, true) : '';
     $docdata['description1'] = $docdata['description1'] ? shorten_text($docdata['description1'], static::SEARCH_RESULT_TEXT_SIZE, true) : '';
     $docdata['description2'] = $docdata['description2'] ? shorten_text($docdata['description2'], static::SEARCH_RESULT_TEXT_SIZE, true) : '';
     return $this->output->render_from_template('core_search/result', $docdata);
 }