From 60b57b618967587a6d49e3332328dd74350dd186 Mon Sep 17 00:00:00 2001 From: Brian Barnes Date: Thu, 4 Dec 2014 13:42:35 +1300 Subject: [PATCH] MDL-48482 core_admin: Added additional label for durations --- lang/en/admin.php | 1 + lib/adminlib.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lang/en/admin.php b/lang/en/admin.php index 7cfb317ce92..8089a7f792a 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -439,6 +439,7 @@ $string['doclang'] = 'Language for docs'; $string['docroot'] = 'Moodle Docs document root'; $string['doctonewwindow'] = 'Open in new window'; $string['download'] = 'Download'; +$string['durationunits'] = 'duration units'; $string['edithelpdocs'] = 'Edit help documents'; $string['editlang'] = 'Edit'; $string['editorbackgroundcolor'] = 'Background colour'; diff --git a/lib/adminlib.php b/lib/adminlib.php index 0c6aafe9d38..cd8c9612697 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -3389,8 +3389,13 @@ class admin_setting_configduration extends admin_setting { $units = self::get_units(); + $inputid = $this->get_id() . 'v'; + $return = '
'; - $return .= ''; + $return .= ''; + $return .= ''; $return .= '
'; - return format_admin_setting($this, $this->visiblename, $return, $this->description, false, '', $defaultinfo, $query); + return format_admin_setting($this, $this->visiblename, $return, $this->description, $inputid, '', $defaultinfo, $query); } } @@ -6907,7 +6912,7 @@ function admin_output_new_settings_by_page($node) { * @param string $title label element * @param string $form form fragment, html code - not highlighted automatically * @param string $description - * @param bool $label link label to id, true by default + * @param mixed $label link label to id, true by default or string being the label to connect it to * @param string $warning warning text * @param sting $defaultinfo defaults info, null means nothing, '' is converted to "Empty" string, defaults to null * @param string $query search query to be highlighted @@ -6920,10 +6925,12 @@ function format_admin_setting($setting, $title='', $form='', $description='', $l $fullname = $setting->get_full_name(); // sometimes the id is not id_s_name, but id_s_name_m or something, and this does not validate - if ($label) { + if ($label === true) { $labelfor = 'for = "'.$setting->get_id().'"'; - } else { + } else if ($label === false) { $labelfor = ''; + } else { + $labelfor = 'for="' . $label . '"'; } $form .= $setting->output_setting_flags();