mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-67547 dataformat: allow plugins to declare support for HTML.
This commit is contained in:
parent
a09eb2697f
commit
118a109499
6 changed files with 62 additions and 10 deletions
|
@ -145,6 +145,27 @@ abstract class base {
|
|||
// Override me if needed.
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to define whether the dataformat supports export of HTML
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function supports_html(): bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply formatting to the cells of a given record
|
||||
*
|
||||
* @param array|\stdClass $record
|
||||
* @return array
|
||||
*/
|
||||
protected function format_record($record): array {
|
||||
$record = (array)$record;
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a single record
|
||||
*
|
||||
|
|
|
@ -116,11 +116,11 @@ abstract class spout_base extends \core\dataformat\base {
|
|||
/**
|
||||
* Write a single record
|
||||
*
|
||||
* @param object $record
|
||||
* @param array $record
|
||||
* @param int $rownum
|
||||
*/
|
||||
public function write_record($record, $rownum) {
|
||||
$row = \Box\Spout\Writer\Common\Creator\WriterEntityFactory::createRowFromArray((array)$record);
|
||||
$row = \Box\Spout\Writer\Common\Creator\WriterEntityFactory::createRowFromArray($this->format_record($record));
|
||||
$this->writer->addRow($row);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue