MDL-59775 forms: add option to display any form vertical

This commit is contained in:
Marina Glancy 2017-08-10 12:34:53 +08:00
parent 032674eebc
commit 3dee4faec4
4 changed files with 81 additions and 6 deletions

View file

@ -1411,6 +1411,16 @@ abstract class moodleform {
return $data;
}
/**
* Set display mode for the form when labels take full width of the form and above the elements even on big screens
*
* Useful for forms displayed inside modals or in narrow containers
*/
public function set_display_vertical() {
$oldclass = $this->_form->getAttribute('class');
$this->_form->updateAttributes(array('class' => $oldclass . ' full-width-labels'));
}
}
/**