MDL-73363 page: Remove printheading settings from page.

This commit is contained in:
Peter Dias 2022-01-05 09:50:54 +08:00
parent e63604fb6d
commit 95b674062f
10 changed files with 12 additions and 22 deletions

View File

@ -72,7 +72,7 @@ class moodle1_mod_page_handler extends moodle1_resource_successor_handler {
$page['timemodified'] = $data['timemodified'];
// populate display and displayoptions fields
$options = array('printheading' => 1, 'printintro' => 0);
$options = array('printintro' => 0);
if ($data['popup']) {
$page['display'] = RESOURCELIB_DISPLAY_POPUP;
$rawoptions = explode(',', $data['popup']);

View File

@ -0,0 +1,2 @@
printheading,mod_page
printheadingexplain,mod_page

View File

@ -66,11 +66,13 @@ $string['popupheight'] = 'Pop-up height (in pixels)';
$string['popupheightexplain'] = 'Specifies default height of popup windows.';
$string['popupwidth'] = 'Pop-up width (in pixels)';
$string['popupwidthexplain'] = 'Specifies default width of popup windows.';
$string['printheading'] = 'Display page name';
$string['printheadingexplain'] = 'Display page name above content?';
$string['printintro'] = 'Display page description';
$string['printintroexplain'] = 'Display page description above content?';
$string['printlastmodified'] = 'Display last modified date';
$string['printlastmodifiedexplain'] = 'Display last modified date below content?';
$string['privacy:metadata'] = 'The Page resource plugin does not store any personal data.';
$string['search:activity'] = 'Page';
// Deprecated since 4.0.
$string['printheading'] = 'Display page name';
$string['printheadingexplain'] = 'Display page name above content?';

View File

@ -104,7 +104,6 @@ function page_add_instance($data, $mform = null) {
$displayoptions['popupwidth'] = $data->popupwidth;
$displayoptions['popupheight'] = $data->popupheight;
}
$displayoptions['printheading'] = $data->printheading;
$displayoptions['printintro'] = $data->printintro;
$displayoptions['printlastmodified'] = $data->printlastmodified;
$data->displayoptions = serialize($displayoptions);
@ -154,7 +153,6 @@ function page_update_instance($data, $mform) {
$displayoptions['popupwidth'] = $data->popupwidth;
$displayoptions['popupheight'] = $data->popupheight;
}
$displayoptions['printheading'] = $data->printheading;
$displayoptions['printintro'] = $data->printintro;
$displayoptions['printlastmodified'] = $data->printlastmodified;
$data->displayoptions = serialize($displayoptions);
@ -488,7 +486,6 @@ function page_dndupload_handle($uploadinfo) {
$data->display = $config->display;
$data->popupheight = $config->popupheight;
$data->popupwidth = $config->popupwidth;
$data->printheading = $config->printheading;
$data->printintro = $config->printintro;
$data->printlastmodified = $config->printlastmodified;

View File

@ -88,8 +88,6 @@ class mod_page_mod_form extends moodleform_mod {
$mform->setDefault('popupheight', $config->popupheight);
}
$mform->addElement('advcheckbox', 'printheading', get_string('printheading', 'page'));
$mform->setDefault('printheading', $config->printheading);
$mform->addElement('advcheckbox', 'printintro', get_string('printintro', 'page'));
$mform->setDefault('printintro', $config->printintro);
$mform->addElement('advcheckbox', 'printlastmodified', get_string('printlastmodified', 'page'));
@ -134,9 +132,6 @@ class mod_page_mod_form extends moodleform_mod {
if (isset($displayoptions['printintro'])) {
$defaultvalues['printintro'] = $displayoptions['printintro'];
}
if (isset($displayoptions['printheading'])) {
$defaultvalues['printheading'] = $displayoptions['printheading'];
}
if (isset($displayoptions['printlastmodified'])) {
$defaultvalues['printlastmodified'] = $displayoptions['printlastmodified'];
}

View File

@ -39,8 +39,6 @@ if ($ADMIN->fulltree) {
//--- modedit defaults -----------------------------------------------------------------------------------
$settings->add(new admin_setting_heading('pagemodeditdefaults', get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin')));
$settings->add(new admin_setting_configcheckbox('page/printheading',
get_string('printheading', 'page'), get_string('printheadingexplain', 'page'), 1));
$settings->add(new admin_setting_configcheckbox('page/printintro',
get_string('printintro', 'page'), get_string('printintroexplain', 'page'), 0));
$settings->add(new admin_setting_configcheckbox('page/printlastmodified',

View File

@ -22,8 +22,6 @@ Feature: Configure page appearance
Examples:
| feature | lookfor | value | shouldornot |
| Display page name | PageName1 | 1 | should |
| Display page name | PageName1 | 0 | should not |
| Display page description | PageDesc1 | 1 | should |
| Display page description | PageDesc1 | 0 | should not |
| Display last modified date | Last modified: | 1 | should |

View File

@ -51,9 +51,6 @@ class mod_page_generator extends testing_module_generator {
if (!isset($record->display)) {
$record->display = RESOURCELIB_DISPLAY_AUTO;
}
if (!isset($record->printheading)) {
$record->printheading = 1;
}
if (!isset($record->printintro)) {
$record->printintro = 0;
}

5
mod/page/upgrade.txt Normal file
View File

@ -0,0 +1,5 @@
This files describes API changes in the mod_page code.
=== 4.0 ===
* Removed printheading from page and admin settings. This will now be handled by the activity header and/or theme.

View File

@ -59,10 +59,6 @@ $PAGE->set_url('/mod/page/view.php', array('id' => $cm->id));
$options = empty($page->displayoptions) ? [] : (array) unserialize_array($page->displayoptions);
$activityheader = ['hidecompletion' => false];
if (empty($options['printheading'])) {
$activityheader['title'] = '';
}
if (empty($options['printintro']) || !trim(strip_tags($page->intro))) {
$activityheader['description'] = '';
}