Skip to content

Commit

Permalink
Deprecate the viewMode preset setting. Bump to 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Apr 13, 2024
1 parent f226de3 commit 1941267
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ColorMate Changelog

## 2.3.0 - 2024-04-13
### Changed
- Deprecated the `viewMode` config setting for presets

## 2.2.3.1 - 2024-04-02
### Fixed
- Add that min-height back in 🙃
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vaersaagod/colormate",
"description": "Color me impressed, mate!",
"version": "2.2.3.1",
"version": "2.3.0",
"type": "craft-plugin",
"keywords": [
"craft",
Expand Down
10 changes: 8 additions & 2 deletions src/fields/ColorMateField.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@
class ColorMateField extends Field implements PreviewableFieldInterface
{

/** @var string */
/**
* @var string
* @deprecated Since 2.3.0
*/
public const FIELD_VIEW_MODE_COMPACT = 'compact';

/** @var string */
/**
* @var string
* @deprecated Since 2.3.0
*/
public const FIELD_VIEW_MODE_EXPANDED = 'expanded';

/** @var string */
Expand Down
13 changes: 12 additions & 1 deletion src/models/Preset.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

namespace vaersaagod\colormate\models;

use Craft;
use craft\base\Model;

use vaersaagod\colormate\fields\ColorMateField;

/**
Expand All @@ -32,6 +34,7 @@ class Preset extends Model

/**
* @var string
* @deprecated Since 2.3.0
*/
public string $viewMode = ColorMateField::FIELD_VIEW_MODE_COMPACT;

Expand Down Expand Up @@ -64,7 +67,15 @@ class Preset extends Model
* @var string|null
*/
public ?string $default = null;


/** @inheritdoc */
public function init(): void
{
parent::init();
if (!empty($this->viewMode)) {
Craft::$app->getDeprecator()->log(__METHOD__, "The `viewMode` preset config setting is deprecated. You should remove references to it from your `colormate.php` config file.");
}
}

/**
* @return PresetColor[]
Expand Down

0 comments on commit 1941267

Please sign in to comment.