From 9b57d25cd7faf6e71e759651441c4e67020c668f Mon Sep 17 00:00:00 2001 From: okaufman Date: Tue, 3 Sep 2024 15:51:49 +0200 Subject: [PATCH] fixes #30 --- ...class.ilOpencastPageComponentPluginGUI.php | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/classes/class.ilOpencastPageComponentPluginGUI.php b/classes/class.ilOpencastPageComponentPluginGUI.php index 5ba14ab..3b206cf 100644 --- a/classes/class.ilOpencastPageComponentPluginGUI.php +++ b/classes/class.ilOpencastPageComponentPluginGUI.php @@ -525,20 +525,24 @@ protected function setStyleFromProps(ilTemplate $tpl, array $properties) $tpl->setVariable('RATIO', $ratio); $tpl->setVariable('MAX-WIDTH', $properties[self::PROP_WIDTH]); $tpl->setVariable('MAX-HEIGHT', $properties[self::PROP_HEIGHT]); - if ($properties[self::PROP_RESPONSIVE] != false) { - $tpl->setVariable('WIDTH', 'width:100%;'); + if (array_key_exists(self::PROP_RESPONSIVE, $properties)) { + if ($properties[self::PROP_RESPONSIVE] != false) { + $tpl->setVariable('WIDTH', 'width:100%;'); + } } - switch ($properties[self::PROP_POSITION]) { - case self::POSITION_CENTER: - $tpl->setVariable('CONTAINER_STYLE', 'text-align:center;'); - break; - case self::POSITION_RIGHT: - $tpl->setVariable('CONTAINER_STYLE', 'text-align:right;'); - break; - case self::POSITION_LEFT: - default: - $tpl->setVariable('CONTAINER_STYLE', 'text-align:left;'); - break; + if (array_key_exists(self::PROP_POSITION, $properties)) { + switch ($properties[self::PROP_POSITION]) { + case self::POSITION_CENTER: + $tpl->setVariable('CONTAINER_STYLE', 'text-align:center;'); + break; + case self::POSITION_RIGHT: + $tpl->setVariable('CONTAINER_STYLE', 'text-align:right;'); + break; + case self::POSITION_LEFT: + default: + $tpl->setVariable('CONTAINER_STYLE', 'text-align:left;'); + break; + } } }