mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-65069 core_form: Expose the form's submit's class attribute
Exposed the submit button's class attribute so it can be overriden by custom classes provided by the programmer.
This commit is contained in:
parent
97babbf7d7
commit
e455d6f483
3 changed files with 30 additions and 6 deletions
|
@ -48,6 +48,13 @@ class MoodleQuickForm_submit extends HTML_QuickForm_submit implements templatabl
|
|||
*/
|
||||
protected $primary;
|
||||
|
||||
/**
|
||||
* Any class apart from 'btn' would be override with this content
|
||||
*
|
||||
* @var string $customclassoverride Custom class override for the input element
|
||||
*/
|
||||
protected $customclassoverride;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
|
@ -65,6 +72,12 @@ class MoodleQuickForm_submit extends HTML_QuickForm_submit implements templatabl
|
|||
} else {
|
||||
$this->primary = $primary;
|
||||
}
|
||||
|
||||
$class = $this->getAttribute('customclassoverride');
|
||||
if ($class) {
|
||||
$this->removeAttribute('customclassoverride');
|
||||
$this->customclassoverride = $class;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,6 +144,10 @@ class MoodleQuickForm_submit extends HTML_QuickForm_submit implements templatabl
|
|||
if (!$this->primary) {
|
||||
$context['secondary'] = true;
|
||||
}
|
||||
|
||||
if ($this->customclassoverride) {
|
||||
$context['customclass'] = $this->customclassoverride;
|
||||
}
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue