fixed label line, added pos in arrays as first (note its not the best fix, but it shouldnt break everything)
This commit is contained in:
parent
ea33ebc47b
commit
de6c57fc73
@ -349,15 +349,18 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a line of labels
|
* Adds a line of labels
|
||||||
|
* NOTE ALWAYS SET posIsKey Manually to true
|
||||||
*
|
*
|
||||||
* @param Frame $frame
|
* @param Frame $frame
|
||||||
* @param array $labelStrings
|
* @param array $labelStrings if(posIsKey) array($pos => $value)
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
|
* @param boolean $posIsKey
|
||||||
* @return Label_Text[]
|
* @return Label_Text[]
|
||||||
*/
|
*/
|
||||||
public function labelLine(Frame $frame, array $labelStrings, array $properties = array()) {
|
public function labelLine(Frame $frame, array $labelStrings, array $properties = array(), $posIsKey = false) {
|
||||||
// define standard properties
|
// define standard properties
|
||||||
$hAlign = (isset($properties['hAlign']) ? $properties['hAlign'] : Control::LEFT);
|
$hAlign = (isset($properties['hAlign']) ? $properties['hAlign'] : Control::LEFT);
|
||||||
$style = (isset($properties['style']) ? $properties['style'] : Label_Text::STYLE_TextCardSmall);
|
$style = (isset($properties['style']) ? $properties['style'] : Label_Text::STYLE_TextCardSmall);
|
||||||
@ -366,7 +369,15 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
$profile = (isset($properties['profile']) ? $properties['profile'] : false);
|
$profile = (isset($properties['profile']) ? $properties['profile'] : false);
|
||||||
|
|
||||||
$labels = array();
|
$labels = array();
|
||||||
foreach ($labelStrings as $text => $x) {
|
foreach ($labelStrings as $key => $value) {
|
||||||
|
if ($posIsKey) {
|
||||||
|
$x = $key;
|
||||||
|
$text = $value;
|
||||||
|
} else {
|
||||||
|
$x = $value;
|
||||||
|
$text = $key;
|
||||||
|
}
|
||||||
|
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setHAlign($hAlign);
|
$label->setHAlign($hAlign);
|
||||||
|
Loading…
Reference in New Issue
Block a user