MDL-79705 profilefield_checkbox: display data as simple Yes/No.

This commit is contained in:
Paul Holden
2023-10-17 16:51:29 +01:00
parent 13eb20d8d1
commit 021bdd0e4b
+2 -12
View File
@@ -14,17 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'profilefield_checkbox', language 'en', branch 'MOODLE_20_STABLE'
*
* @package profilefield_checkbox
* @copyright 2008 onwards Shane Elliot {@link http://pukunui.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Class profile_field_checkbox
*
* @package profilefield_checkbox
* @copyright 2008 onwards Shane Elliot {@link http://pukunui.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -52,10 +45,7 @@ class profile_field_checkbox extends profile_field_base {
* @return string HTML.
*/
public function display_data() {
$options = new stdClass();
$options->para = false;
$checked = intval($this->data) === 1 ? 'checked="checked"' : '';
return '<input disabled="disabled" type="checkbox" name="'.$this->inputname.'" '.$checked.' />';
return $this->data ? get_string('yes') : get_string('no');
}
/**