MDL-86564 mod_choice: Export a pix_icon in overview external
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
namespace mod_choice\courseformat;
|
||||
|
||||
use cm_info;
|
||||
use core\output\pix_icon;
|
||||
use mod_choice\manager;
|
||||
use core\activity_dates;
|
||||
use core\output\action_link;
|
||||
@@ -136,14 +137,13 @@ class overview extends \core_courseformat\activityoverviewbase {
|
||||
if ($status) {
|
||||
$statustext = get_string('answered', 'choice');
|
||||
}
|
||||
$corerenderer = $this->rendererhelper->get_core_renderer();
|
||||
$submittedstatuscontent = "-";
|
||||
if ($status) {
|
||||
$submittedstatuscontent = $corerenderer->pix_icon(
|
||||
'i/checkedcircle',
|
||||
$statustext,
|
||||
'core',
|
||||
['class' => 'text-success'],
|
||||
$submittedstatuscontent = new pix_icon(
|
||||
pix: 'i/checkedcircle',
|
||||
alt: $statustext,
|
||||
component: 'core',
|
||||
attributes: ['class' => 'text-success'],
|
||||
);
|
||||
}
|
||||
return new overviewitem(
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
namespace mod_choice\courseformat;
|
||||
|
||||
use core\output\pix_icon;
|
||||
use core_courseformat\local\overview\overviewfactory;
|
||||
|
||||
/**
|
||||
@@ -49,8 +50,11 @@ final class overview_test extends \advanced_testcase {
|
||||
$this->assertNull($actionoverview['responded']);
|
||||
} else {
|
||||
$this->assertEquals($answered, $actionoverview['responded']->get_value());
|
||||
$content = $actionoverview['responded']->get_content();
|
||||
if (!$answered) {
|
||||
$this->assertEquals('-', $actionoverview['responded']->get_content());
|
||||
$this->assertEquals('-', $content);
|
||||
} else {
|
||||
$this->assertInstanceOf(pix_icon::class, $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user