Skip to content

Commit

Permalink
MDL-55127 mod_data: Adding missing required classes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Aug 24, 2016
1 parent 3037458 commit 7000383
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions mod/data/classes/search/entry.php
Expand Up @@ -283,7 +283,7 @@ protected function get_fields_for_entries($entry) {
}

foreach ($filteredcontents as $content) {
$classname = 'data_field_' . trim($content->fieldtype);
$classname = $this->get_field_class_name($content->fieldtype);
$content->priority = $classname::get_priority();
$content->addtemplateposition = strpos($template, '[['.$content->fldname.']]');
}
Expand Down Expand Up @@ -319,12 +319,25 @@ protected function get_fields_for_entries($entry) {
while ($contentqueue->valid()) {

$content = $contentqueue->extract();
$classname = 'data_field_' . trim($content->fieldtype);
$classname = $this->get_field_class_name($content->fieldtype);

$indexfields[] = $classname::get_content_value($content->content);
}

return $indexfields;
}

}
/**
* Returns the class name for that field type and includes it.
*
* @param string $fieldtype
* @return string
*/
protected function get_field_class_name($fieldtype) {
global $CFG;

$fieldtype = trim($fieldtype);
require_once($CFG->dirroot . '/mod/data/field/' . $fieldtype . '/field.class.php');
return 'data_field_' . $fieldtype;
}
}

0 comments on commit 7000383

Please sign in to comment.