mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-73274 theme_boost: add block/activity styling
This commit is contained in:
parent
508fe3937e
commit
a8b6912e44
14 changed files with 63 additions and 86 deletions
|
@ -4900,6 +4900,36 @@ EOD;
|
|||
return $CFG->release;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the add block button when editing mode is turned on and the user can edit blocks.
|
||||
*
|
||||
* @param string $region where new blocks should be added.
|
||||
* @return string html for the add block button.
|
||||
*/
|
||||
public function addblockbutton($region = ''): string {
|
||||
$addblockbutton = '';
|
||||
if (isset($this->page->theme->addblockposition) &&
|
||||
$this->page->user_is_editing() &&
|
||||
$this->page->user_can_edit_blocks() &&
|
||||
$this->page->pagelayout !== 'mycourses'
|
||||
) {
|
||||
$params = ['bui_addblock' => '', 'sesskey' => sesskey()];
|
||||
if (!empty($region)) {
|
||||
$params['bui_blockregion'] = $region;
|
||||
}
|
||||
$url = new moodle_url($this->page->url, $params);
|
||||
$addblockbutton = $this->render_from_template('core/add_block_button',
|
||||
[
|
||||
'link' => $url->out(false),
|
||||
'escapedlink' => "?{$url->get_query_string(false)}",
|
||||
'pageType' => $this->page->pagetype,
|
||||
'pageLayout' => $this->page->pagelayout,
|
||||
]
|
||||
);
|
||||
}
|
||||
return $addblockbutton;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,10 +28,11 @@
|
|||
}
|
||||
|
||||
}}
|
||||
<a href="{{link}}" id="addblock-{{uniqid}}" class="btn btn-link block-add text-left" data-key="addblock" data-url="{{escapedlink}}">
|
||||
{{#str}}addblock{{/str}}
|
||||
<i class="fa fa-plus-square pull-right py-1" aria-hidden="true"></i>
|
||||
</a>
|
||||
<div class="add_block_button">
|
||||
<a href="{{link}}" id="addblock-{{uniqid}}" class="btn btn-link block-add text-left mb-3" data-key="addblock" data-url="{{escapedlink}}">
|
||||
<i class="fa fa-plus py-2 mr-3" aria-hidden="true"></i>{{#str}}addblock{{/str}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{{#js}}
|
||||
// Initialise the JS for the modal window which displays the blocks available to add.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue