mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-82351 format_social: migrate to reactive course editor
The commit adds all the necessary methods to allow social format to use the course editor. The code is similar to the one used in the frontpage format. The commit does not include the migration of the social_activities blocks.
This commit is contained in:
parent
fa1296a7a4
commit
8be3db6de2
@ -23,9 +23,12 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['hidefromothers'] = 'Hide';
|
||||
$string['numberdiscussions'] = 'Number of discussions';
|
||||
$string['numberdiscussions_help'] = 'This setting specifies how many discussions should be displayed.';
|
||||
$string['pluginname'] = 'Social';
|
||||
$string['plugin_description'] = 'The course is centred around a main forum on the course page. Additional activities and resources can be added using the Social activities block.';
|
||||
$string['sectionname'] = 'section';
|
||||
$string['privacy:metadata'] = 'The Social format plugin does not store any personal data.';
|
||||
$string['sectionname'] = 'section';
|
||||
$string['showfromothers'] = 'Show';
|
||||
$string['socialactivities'] = 'Social activities';
|
||||
|
@ -129,18 +129,45 @@ class format_social extends core_courseformat\base {
|
||||
return $this->get_format_options();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the information about the ajax support in the given source format.
|
||||
*
|
||||
* The returned object's property (boolean)capable indicates that
|
||||
* the course format supports Moodle course ajax features.
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
#[\Override]
|
||||
public function supports_ajax() {
|
||||
// All home page is rendered in the backend, we only need an ajax editor components in edit mode.
|
||||
// This will also prevent redirectng to the login page when a guest tries to access the site,
|
||||
// and will make the home page loading faster.
|
||||
$ajaxsupport = new stdClass();
|
||||
$ajaxsupport->capable = true;
|
||||
$ajaxsupport->capable = $this->show_editor();
|
||||
return $ajaxsupport;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function supports_components() {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function uses_sections() {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function get_section_name($section) {
|
||||
return get_string('socialactivities', 'format_social');
|
||||
}
|
||||
|
||||
/**
|
||||
* Social format uses only section 0.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
#[\Override]
|
||||
public function get_sectionnum(): int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#[\Override]
|
||||
public function get_max_sections() {
|
||||
// Social ony uses one section.
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user