From a4ee6ca99ea816027f2a5e244cc029e00f32c8f9 Mon Sep 17 00:00:00 2001 From: Meirza Date: Tue, 9 May 2023 11:17:47 +0700 Subject: [PATCH] MDL-78163 lib: Added class properties that are not declared in form In PHP 8.2 and later, setting a value to an undeclared class property is deprecated and emits a deprecation notice. So we need to add missing class properties that still need to be declared. --- lib/form/button.php | 12 ++++++++++++ lib/form/password.php | 12 ++++++++++++ lib/form/radio.php | 12 ++++++++++++ lib/form/url.php | 3 +++ 4 files changed, 39 insertions(+) diff --git a/lib/form/button.php b/lib/form/button.php index 768ef071e1a..1ce5c34809d 100644 --- a/lib/form/button.php +++ b/lib/form/button.php @@ -46,6 +46,9 @@ class MoodleQuickForm_button extends HTML_QuickForm_button implements templatabl /** @var string html for help button, if empty then no help */ var $_helpbutton=''; + /** @var bool if true label will be hidden. */ + protected $_hiddenLabel = false; + /** * constructor * @@ -89,4 +92,13 @@ class MoodleQuickForm_button extends HTML_QuickForm_button implements templatabl return 'default'; } } + + /** + * Sets label to be hidden + * + * @param bool $hiddenLabel sets if label should be hidden + */ + public function setHiddenLabel($hiddenLabel) { + $this->_hiddenLabel = $hiddenLabel; + } } diff --git a/lib/form/password.php b/lib/form/password.php index 11fb680a7ff..3f101d8a324 100644 --- a/lib/form/password.php +++ b/lib/form/password.php @@ -44,6 +44,9 @@ class MoodleQuickForm_password extends HTML_QuickForm_password implements templa /** @var string, html for help button, if empty then no help */ var $_helpbutton=''; + /** @var bool if true label will be hidden. */ + protected $_hiddenLabel = false; + /** * constructor * @@ -91,4 +94,13 @@ class MoodleQuickForm_password extends HTML_QuickForm_password implements templa function getHelpButton(){ return $this->_helpbutton; } + + /** + * Sets label to be hidden + * + * @param bool $hiddenLabel sets if label should be hidden + */ + public function setHiddenLabel($hiddenLabel) { + $this->_hiddenLabel = $hiddenLabel; + } } diff --git a/lib/form/radio.php b/lib/form/radio.php index 05a0c3682f4..0aea45e8df1 100644 --- a/lib/form/radio.php +++ b/lib/form/radio.php @@ -43,6 +43,9 @@ class MoodleQuickForm_radio extends HTML_QuickForm_radio implements templatable /** @var string html for help button, if empty then no help */ var $_helpbutton=''; + /** @var bool if true label will be hidden. */ + protected $_hiddenLabel = false; + /** * constructor * @@ -115,4 +118,13 @@ class MoodleQuickForm_radio extends HTML_QuickForm_radio implements templatable { return '' . parent::toHtml() . ''; } + + /** + * Sets label to be hidden + * + * @param bool $hiddenLabel sets if label should be hidden + */ + public function setHiddenLabel($hiddenLabel) { + $this->_hiddenLabel = $hiddenLabel; + } } diff --git a/lib/form/url.php b/lib/form/url.php index 93f0cba0441..44c8d0fe954 100644 --- a/lib/form/url.php +++ b/lib/form/url.php @@ -51,6 +51,9 @@ class MoodleQuickForm_url extends HTML_QuickForm_text implements templatable { /** @var string the unique id of the filepicker, if enabled.*/ protected $filepickeruniqueid; + /** @var array data which need to be posted. */ + protected $_options; + /** * Constructor *