Fix deprecated BoostrapComponent with BS5 light and dark colors

This commit is contained in:
Marc Farré 2025-01-13 14:00:24 +00:00
parent 77638f0c5c
commit ad049c3e51
2 changed files with 20 additions and 13 deletions

View File

@ -55,6 +55,8 @@ abstract class BootstrapComponent extends Widget
public const TYPE_WARNING = 'warning';
public const TYPE_DANGER = 'danger';
public const TYPE_SUCCESS = 'success';
public const TYPE_LIGHT = 'light';
public const TYPE_DARK = 'dark';
public const TYPE_NONE = 'none';
public $type;
@ -148,6 +150,24 @@ abstract class BootstrapComponent extends Widget
return new static(['type' => self::TYPE_DANGER, 'text' => $text]);
}
/**
* @param string $text Button text
* @return static
*/
public static function light($text = null)
{
return new static(['type' => self::TYPE_LIGHT, 'text' => $text]);
}
/**
* @param string $text Button text
* @return static
*/
public static function dark($text = null)
{
return new static(['type' => self::TYPE_DARK, 'text' => $text]);
}
/**
* @param $color
* @param null $text

View File

@ -20,10 +20,6 @@ use humhub\helpers\Html;
*/
class Label extends BootstrapComponent
{
/**
* @since 1.9
*/
public const TYPE_LIGHT = 'light';
public $_sortOrder = 1000;
public $encode = true;
@ -31,15 +27,6 @@ class Label extends BootstrapComponent
public $_link;
public $_action;
/**
* @param string $text Label text
* @return static
* @since 1.9
*/
public static function light($text)
{
return new static(['type' => static::TYPE_LIGHT, 'text' => $text]);
}
public function sortOrder($sortOrder)
{