mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-65033 mod_forum: Pass the favourites into the exporter
Query and pass the favouriting information into the exporter instead of within the exporter itself
This commit is contained in:
parent
8885cd573a
commit
13cd05ac14
22 changed files with 268 additions and 112 deletions
10
lib/classes/external/exporter.php
vendored
10
lib/classes/external/exporter.php
vendored
|
@ -79,14 +79,16 @@ abstract class exporter {
|
|||
}
|
||||
|
||||
$missingdataerr = 'Exporter class is missing required related data: (' . get_called_class() . ') ';
|
||||
$scalartypes = ['string', 'int', 'bool', 'float'];
|
||||
$scalarcheck = 'is_' . $classname;
|
||||
|
||||
if ($nullallowed && array_key_exists($key, $related) && $related[$key] === null) {
|
||||
$this->related[$key] = $related[$key];
|
||||
if ($nullallowed && (!array_key_exists($key, $related) || $related[$key] === null)) {
|
||||
$this->related[$key] = null;
|
||||
|
||||
} else if ($isarray) {
|
||||
if (array_key_exists($key, $related) && is_array($related[$key])) {
|
||||
foreach ($related[$key] as $index => $value) {
|
||||
if (!$value instanceof $classname) {
|
||||
if (!$value instanceof $classname && !$scalarcheck($value)) {
|
||||
throw new coding_exception($missingdataerr . $key . ' => ' . $classname . '[]');
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +98,6 @@ abstract class exporter {
|
|||
}
|
||||
|
||||
} else {
|
||||
$scalartypes = ['string', 'int', 'bool', 'float'];
|
||||
$scalarcheck = 'is_' . $classname;
|
||||
if (array_key_exists($key, $related) &&
|
||||
((in_array($classname, $scalartypes) && $scalarcheck($related[$key])) ||
|
||||
($related[$key] instanceof $classname))) {
|
||||
|
|
|
@ -356,6 +356,7 @@ class icon_system_fontawesome extends icon_system_font {
|
|||
'core:t/edit' => 'fa-cog',
|
||||
'core:t/emailno' => 'fa-ban',
|
||||
'core:t/email' => 'fa-envelope-o',
|
||||
'core:t/emptystar' => 'fa-star-o',
|
||||
'core:t/enrolusers' => 'fa-user-plus',
|
||||
'core:t/expanded' => 'fa-caret-down',
|
||||
'core:t/go' => 'fa-play',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue