public function CourseObjectPoll::getReport in Course 3.x
Let the course object provide its own reports.
Return value
array An array containing:
- title: The title of this report as show on the page
- content: Content to be displayed.
- url: URL to be loaded in an iframe.
Reports should return either 'content' or 'url'.
Overrides CourseObject::getReport
File
- modules/
course_poll/ src/ Plugin/ course/ CourseObject/ CourseObjectPoll.php, line 89
Class
- CourseObjectPoll
- Plugin annotation @CourseObject( id = "poll", label = "Poll", handlers = { "fulfillment" = "\Drupal\course_poll\Plugin\course\CourseObject\CourseObjectPollFulfillment" } )
Namespace
Drupal\course_poll\Plugin\course\CourseObjectCode
public function getReport($key) {
module_load_include('inc', 'poll', 'poll.pages');
switch ($key) {
case 'results':
return array(
'title' => $this
->getNode()->title,
'content' => poll_view_results($this
->getNode(), NULL, NULL, NULL),
);
case 'all':
$out = poll_votes($this
->getNode());
return array(
'title' => 'All votes',
'content' => Drupal::service('renderer')
->render($out),
);
}
return parent::getReport($key);
}