mirror of
https://github.com/moodle/moodle.git
synced 2025-08-11 03:46:42 +02:00
MDL-81050 output: Add new 'attributes' parameter to container
This commit is contained in:
parent
757be30c39
commit
b73a685ef7
3 changed files with 10 additions and 6 deletions
|
@ -3404,10 +3404,11 @@ EOD;
|
|||
* @param string $contents The contents of the box
|
||||
* @param string $classes A space-separated list of CSS classes
|
||||
* @param string $id An optional ID
|
||||
* @param array $attributes Optional other attributes as array
|
||||
* @return string the HTML to output.
|
||||
*/
|
||||
public function container($contents, $classes = null, $id = null) {
|
||||
return $this->container_start($classes, $id) . $contents . $this->container_end();
|
||||
public function container($contents, $classes = null, $id = null, $attributes = []) {
|
||||
return $this->container_start($classes, $id, $attributes) . $contents . $this->container_end();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3415,12 +3416,13 @@ EOD;
|
|||
*
|
||||
* @param string $classes A space-separated list of CSS classes
|
||||
* @param string $id An optional ID
|
||||
* @param array $attributes Optional other attributes as array
|
||||
* @return string the HTML to output.
|
||||
*/
|
||||
public function container_start($classes = null, $id = null) {
|
||||
public function container_start($classes = null, $id = null, $attributes = []) {
|
||||
$this->opencontainers->push('container', html_writer::end_tag('div'));
|
||||
return html_writer::start_tag('div', array('id' => $id,
|
||||
'class' => renderer_base::prepare_classes($classes)));
|
||||
$attributes = array_merge(['id' => $id, 'class' => renderer_base::prepare_classes($classes)], $attributes);
|
||||
return html_writer::start_tag('div', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -90,6 +90,8 @@ information provided here is intended especially for developers.
|
|||
- `question_category_options`
|
||||
- `question_add_context_in_key`
|
||||
- `question_fix_top_names`
|
||||
* Added a new parameter to `core_renderer::container` and `core_renderer::container_start` to allow for the addition of
|
||||
custom attributes.
|
||||
|
||||
=== 4.3 ===
|
||||
|
||||
|
|
|
@ -2216,7 +2216,7 @@ class page_wiki_viewversion extends page_wiki {
|
|||
$pageversion->content = file_rewrite_pluginfile_urls($pageversion->content, 'pluginfile.php', $this->modcontext->id, 'mod_wiki', 'attachments', $this->subwiki->id);
|
||||
|
||||
$parseroutput = wiki_parse_content($pageversion->contentformat, $pageversion->content, $options);
|
||||
$content = $OUTPUT->container(format_text($parseroutput['parsed_text'], FORMAT_HTML, array('overflowdiv'=>true)), false, '', '', true);
|
||||
$content = $OUTPUT->container(format_text($parseroutput['parsed_text'], FORMAT_HTML, ['overflowdiv' => true]));
|
||||
echo $OUTPUT->box($content, 'generalbox wiki_contentbox');
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue