From 97e4a55e03f7cb0a636fd67e39ea167814e7f8df Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 25 Nov 2017 14:34:42 +0100 Subject: [PATCH] allow longer label text for checkboxes --- lam/lib/html.inc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index b9c5d863..880cf23c 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -4016,6 +4016,8 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox { private $helpID; /** render HTML of parent class */ private $renderParentHtml = false; + /** long label */ + private $longLabel = false; /** * Constructor. @@ -4024,11 +4026,13 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox { * @param boolean $checked checked * @param String $label descriptive label * @param String $helpID help ID + * @param bool $longLabel more space for label (default: false) */ - function __construct($name, $checked, $label, $helpID = null) { + function __construct($name, $checked, $label, $helpID = null, $longLabel = false) { parent::__construct($name, $checked); $this->label = htmlspecialchars($label); $this->helpID = $helpID; + $this->longLabel = $longLabel; } /** @@ -4042,10 +4046,16 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox { // HTML of parent class is rendered on second call (done by htmlResponsiveRow) $this->renderParentHtml = true; $row = new htmlResponsiveRow(); + $tabletColumnsLabel = 6; + $tabletColumnsBox = 6; + if ($this->longLabel) { + $tabletColumnsLabel = 10; + $tabletColumnsBox = 2; + } // label text $labelGroup = new htmlGroup(); $labelGroup->addElement(new htmlOutputText($this->label)); - $row->add($labelGroup, 6, 6, 6, 'responsiveLabel'); + $row->add($labelGroup, 10, $tabletColumnsLabel, $tabletColumnsLabel, 'responsiveLabel'); // input field $fieldGroup = new htmlGroup(); $fieldGroup->addElement($this); @@ -4054,7 +4064,7 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox { $helpLink->setCSSClasses(array('margin-left5 align-unset-img')); $fieldGroup->addElement($helpLink); } - $row->add($fieldGroup, 6, 6, 6, 'responsiveField nowrap'); + $row->add($fieldGroup, 2, $tabletColumnsBox, $tabletColumnsBox, 'responsiveField nowrap'); return $row->generateHTML($module, $input, $values, $restricted, $tabindex, $scope); }