MDL-68353 admin: Not use label tag in admin setting elements when needed
This commit is contained in:
@@ -1685,6 +1685,8 @@ abstract class admin_setting {
|
||||
private $forceltr = null;
|
||||
/** @var array list of other settings that may cause this setting to be hidden */
|
||||
private $dependenton = [];
|
||||
/** @var bool Whether this setting uses a custom form control */
|
||||
protected $customcontrol = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -2070,6 +2072,16 @@ abstract class admin_setting {
|
||||
public function get_dependent_on() {
|
||||
return $this->dependenton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this setting uses a custom form control.
|
||||
* This function is especially useful to decide if we should render a label element for this setting or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has_custom_form_control(): bool {
|
||||
return $this->customcontrol;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -8758,6 +8770,7 @@ function format_admin_setting($setting, $title='', $form='', $description='', $l
|
||||
$context->description = highlight($query, markdown_to_html($description));
|
||||
$context->element = $form;
|
||||
$context->forceltr = $setting->get_force_ltr();
|
||||
$context->customcontrol = $setting->has_custom_form_control();
|
||||
|
||||
return $OUTPUT->render_from_template('core_admin/setting', $context);
|
||||
}
|
||||
@@ -10217,6 +10230,7 @@ class admin_setting_configstoredfile extends admin_setting {
|
||||
$this->filearea = $filearea;
|
||||
$this->itemid = $itemid;
|
||||
$this->options = (array)$options;
|
||||
$this->customcontrol = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user