hasComponentAttribute($heightName)) { $heightValue = trim($attributes->getValueAndRemove($heightName)); if ($heightValue !== "") { $heightValue = TagAttributes::toQualifiedCssValue($heightValue); if (in_array($attributes->getLogicalTag(), self::NATURAL_SIZING_ELEMENT)) { /** * A element with a natural height is responsive, we set only the max-height * * By default, the image has a `height: auto` due to the img-fluid class * Making its height responsive */ $attributes->addStyleDeclarationIfNotSet("max-height", $heightValue); } else { /** * HTML Block * * Without the height value, a block display will collapse */ if (self::HEIGHT_LAYOUT_DEFAULT == self::DESIGN_LAYOUT_CONSTRAINED) { /** * The box is constrained in height * By default, a box is not constrained */ $attributes->addStyleDeclarationIfNotSet("height", $heightValue); $scrollMechanism = $attributes->getValueAndRemoveIfPresent(Dimension::SCROLL); if ($scrollMechanism !== null) { $scrollMechanism = trim(strtolower($scrollMechanism)); } switch ($scrollMechanism) { case self::SCROLL_TOGGLE_MECHANISM: // https://jsfiddle.net/gerardnico/h0g6xw58/ $attributes->addStyleDeclarationIfNotSet("overflow-y", "hidden"); $attributes->addStyleDeclarationIfNotSet("position", "relative"); $attributes->addStyleDeclarationIfNotSet("display", "block"); // The block should collapse to this height $attributes->addStyleDeclarationIfNotSet("min-height", $heightValue); if ($attributes->hasComponentAttribute("id")) { $id = $attributes->getValue("id"); } else { $id = $attributes->generateAndSetId(); } /** * Css of the button and other standard attribute */ PluginUtility::getSnippetManager()->attachCssInternalStyleSheet("height-toggle"); /** * Set the color dynamically to the color of the parent */ PluginUtility::getSnippetManager()->attachJavascriptFromComponentId("height-toggle"); $toggleOnClickId = "height-toggle-onclick"; $attributes->addClassName(StyleAttribute::addComboStrapSuffix($toggleOnClickId)); $attributes->addStyleDeclarationIfNotSet("cursor", "pointer"); PluginUtility::getSnippetManager()->attachJavascriptFromComponentId($toggleOnClickId); /** * The height when there is not the show class * is the original height */ $css = <<attachCssInternalStyleSheet("height-toggle-show", $css); $bootstrapDataNameSpace = Bootstrap::getDataNamespace(); $buttonClass = StyleAttribute::addComboStrapSuffix("height-toggle"); /** @noinspection HtmlUnknownAttribute */ $button = <<