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

This commit is contained in:
Paul Holden 2023-10-16 17:21:55 +01:00
parent d188d58ce9
commit 62aa37f70d
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164

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');
}
/**