Commit 831d4560 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow local customisation of the "Edit site pages" list (bug #999464)



Sites with custom pages that have been added into the menu somewhere
sometimes want to make the content editable by site admins, so it
should be possible to add to the default list by defining a function
in local/lib.php, along with appropriate language strings.

Change-Id: Ia62a6554963517bdc62a8263e855b2ef51c3b9bd
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 420b2530
......@@ -38,13 +38,17 @@ define('TITLE', get_string('editsitepages', 'admin'));
define('DEFAULTPAGE', 'home');
$sitepages = array();
$sitepagenames = site_content_pages();
if ($sitepagenames) {
$sitepages = get_records_select_array('site_content', 'name IN (' . join(',', array_map('db_quote', $sitepagenames)) . ')');
$corepagenames = site_content_pages();
$localpagenames = function_exists('local_site_content_pages') ? local_site_content_pages() : array();
if ($pagenames = array_merge($corepagenames, $localpagenames)) {
$sitepages = get_records_select_array(
'site_content', 'name IN (' . join(',', array_fill(0, count($pagenames), '?')) . ')', $pagenames
);
}
$pageoptions = array();
foreach ($sitepages as $page) {
$pageoptions[$page->name] = get_string($page->name, 'admin');
$section = in_array($page->name, $localpagenames) ? 'local' : 'admin';
$pageoptions[$page->name] = get_string($page->name, $section);
$pagecontents[$page->name] = $page->content;
}
asort($pageoptions);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment