MDL-81050 output: Add new 'attributes' parameter to container

This commit is contained in:
Mikel Martín
2024-03-19 08:53:49 +01:00
parent 757be30c39
commit b73a685ef7
3 changed files with 10 additions and 6 deletions
+7 -5
View File
@@ -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);
}
/**