Merge branch 'MDL-58315_master_boost_block_classes' of https://github.com/zpottie/moodle

This commit is contained in:
Adrian Greeve 2019-05-09 11:32:19 +08:00
commit 6ab4df423d
3 changed files with 5 additions and 3 deletions

View File

@ -429,13 +429,13 @@ class block_base {
function html_attributes() {
$attributes = array(
'id' => 'inst' . $this->instance->id,
'class' => 'block_' . $this->name(). ' block',
'class' => 'block_' . $this->name() . ' block',
'role' => $this->get_aria_role()
);
if ($this->hide_header()) {
$attributes['class'] .= ' no-header';
}
if ($this->instance_can_be_docked() && get_user_preferences('docked_block_instance_'.$this->instance->id, 0)) {
if ($this->instance_can_be_docked() && get_user_preferences('docked_block_instance_' . $this->instance->id, 0)) {
$attributes['class'] .= ' dock_on_load';
}
return $attributes;

View File

@ -1747,6 +1747,7 @@ class core_renderer extends renderer_base {
$context->showskiplink = !empty($context->skiptitle);
$context->arialabel = $bc->arialabel;
$context->ariarole = !empty($bc->attributes['role']) ? $bc->attributes['role'] : 'complementary';
$context->class = $bc->attributes['class'];
$context->type = $bc->attributes['data-block'];
$context->title = $bc->title;
$context->content = $bc->content;

View File

@ -4,6 +4,7 @@
Example context (json):
{
"id": "block0",
"class": "block block_html",
"showskiplink": true,
"type": "html",
"ariarole": "complementary",
@ -20,7 +21,7 @@
{{! Start Block Container }}
<section id="{{id}}"
class="{{#hidden}}hidden{{/hidden}} block block_{{type}} {{#hascontrols}}block_with_controls{{/hascontrols}} card mb-3"
class="{{#hidden}}hidden{{/hidden}} {{class}} {{#hascontrols}}block_with_controls{{/hascontrols}} card mb-3"
role="{{ariarole}}"
data-block="{{type}}"
{{#arialabel}}