Skip to content

Commit a8ad903

Browse files
committed
Merge branch 'release/2.1.0'
2 parents 28a85d6 + c49d7c1 commit a8ad903

File tree

11 files changed

+102
-75
lines changed

11 files changed

+102
-75
lines changed

CHANGELOG.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,50 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## 2.1.0 - 2024-07-11
8+
### Changed
9+
- Migrated to `jalendport/craft-preparse`
10+
711
## 2.0.2 - 2022-12-05
812
### Fixed
913
- Updated reference to Twigfield
1014

1115
## 2.0.1 - 2022-12-02
1216
### Changed
13-
- Updated to use craft-code-editor instead of craft-twigfield ([#87](https://github.com/besteadfast/craft-preparse-field/pull/87) - thanks @khalwat)
17+
- Updated to use craft-code-editor instead of craft-twigfield ([#87](https://github.com/jalendport/craft-preparse/pull/87) - thanks @khalwat)
1418

1519
## 2.0.0 - 2022-08-08
1620
### Added
1721
- Initial Craft 4 release
1822

1923
## 1.4.1 - 2022-12-02
2024
### Changed
21-
- Updated to use craft-code-editor instead of craft-twigfield ([#86](https://github.com/besteadfast/craft-preparse-field/pull/86) - thanks @khalwat)
25+
- Updated to use craft-code-editor instead of craft-twigfield ([#86](https://github.com/jalendport/craft-preparse/pull/86) - thanks @khalwat)
2226

2327
## 1.4.0 - 2022-08-08
2428
### Added
25-
- Added support for craft-twigfield ([#81](https://github.com/besteadfast/craft-preparse-field/pull/81) - thanks @khalwat)
29+
- Added support for craft-twigfield ([#81](https://github.com/jalendport/craft-preparse/pull/81) - thanks @khalwat)
2630

2731
## 1.3.0 - 2022-08-06
2832
### Added
29-
- Added datetime column type option ([#63](https://github.com/besteadfast/craft-preparse-field/pull/63) - thanks @mmikkel)
33+
- Added datetime column type option ([#63](https://github.com/jalendport/craft-preparse/pull/63) - thanks @mmikkel)
3034

3135
## 1.2.5 - 2021-07-02
3236
### Fixed
33-
- Reverted [#66](https://github.com/besteadfast/craft-preparse-field/pull/66) due to bug where sometimes the element couldn't be re-fetched from the database ([#70](https://github.com/besteadfast/craft-preparse-field/issues/70), [#71](https://github.com/besteadfast/craft-preparse-field/issues/71), [#72](https://github.com/besteadfast/craft-preparse-field/issues/72), [#73](https://github.com/besteadfast/craft-preparse-field/issues/73))
34-
- Fixed a bug causing missing Matrix blocks on elements in certain cases ([#69](https://github.com/besteadfast/craft-preparse-field/issues/69))
37+
- Reverted [#66](https://github.com/jalendport/craft-preparse/pull/66) due to bug where sometimes the element couldn't be re-fetched from the database ([#70](https://github.com/jalendport/craft-preparse/issues/70), [#71](https://github.com/jalendport/craft-preparse/issues/71), [#72](https://github.com/jalendport/craft-preparse/issues/72), [#73](https://github.com/jalendport/craft-preparse/issues/73))
38+
- Fixed a bug causing missing Matrix blocks on elements in certain cases ([#69](https://github.com/jalendport/craft-preparse/issues/69))
3539

3640
## 1.2.4 - 2021-02-24
3741
### Fixed
38-
- Fixed a bug preventing elements from saving successfully in certain multisite setups ([#70](https://github.com/besteadfast/craft-preparse-field/pull/70))
42+
- Fixed a bug preventing elements from saving successfully in certain multisite setups ([#70](https://github.com/jalendport/craft-preparse/pull/70))
3943

4044
## 1.2.3 - 2021-02-23
4145
### Fixed
42-
- Fixed a bug causing missing Matrix blocks on new elements ([#66](https://github.com/besteadfast/craft-preparse-field/pull/66) - thanks @monachilada)
46+
- Fixed a bug causing missing Matrix blocks on new elements ([#66](https://github.com/jalendport/craft-preparse/pull/66) - thanks @monachilada)
4347

4448
## 1.2.2 - 2020-11-30
4549
### Fixed
46-
- Fixed a bug causing missing Matrix blocks on revisions ([#65](https://github.com/besteadfast/craft-preparse-field/pull/65) - thanks @brandonkelly)
50+
- Fixed a bug causing missing Matrix blocks on revisions ([#65](https://github.com/jalendport/craft-preparse/pull/65) - thanks @brandonkelly)
4751

4852
## 1.2.1 - 2020-06-25
4953
### Fixed

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) Steadfast Design Firm
3+
Copyright (c) Jalen Davenport
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To install the plugin, follow these instructions.
1616

1717
2. Then tell Composer to load the plugin:
1818

19-
composer require besteadfast/craft-preparse-field
19+
composer require jalendport/craft-preparse
2020

2121
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Preparse Field.
2222

@@ -77,4 +77,4 @@ The plugin is released under the MIT license, meaning you can do whatever you wa
7777

7878
## Changelog
7979

80-
See the [changelog file](https://github.com/besteadfast/craft-preparse-field/blob/master/CHANGELOG.md).
80+
See the [changelog file](https://github.com/jalendport/craft-preparse/blob/master/CHANGELOG.md).

composer.json

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "besteadfast/craft-preparse-field",
2+
"name": "jalendport/craft-preparse",
33
"description": "A fieldtype that parses Twig when an element is saved and saves the result as plain text.",
44
"type": "craft-plugin",
5-
"version": "2.0.2",
5+
"version": "2.1.0",
66
"keywords": [
77
"craft",
88
"cms",
@@ -13,14 +13,14 @@
1313
"twig"
1414
],
1515
"support": {
16-
"docs": "https://github.com/besteadfast/craft-preparse-field/blob/master/README.md",
17-
"issues": "https://github.com/besteadfast/craft-preparse-field/issues"
16+
"docs": "https://github.com/jalendport/craft-preparse/blob/master/README.md",
17+
"issues": "https://github.com/jalendport/craft-preparse/issues"
1818
},
1919
"license": "MIT",
2020
"authors": [
2121
{
22-
"name": "Steadfast Design Firm",
23-
"homepage": "https://www.steadfastdesignfirm.com/"
22+
"name": "Jalen Davenport",
23+
"homepage": "https://jalendport.com/"
2424
},
2525
{
2626
"name": "André Elvan",
@@ -34,19 +34,12 @@
3434
},
3535
"autoload": {
3636
"psr-4": {
37-
"besteadfast\\preparsefield\\": "src/"
37+
"jalendport\\preparse\\": "src/"
3838
}
3939
},
4040
"extra": {
41-
"name": "Preparse Field",
41+
"name": "Preparse",
4242
"handle": "preparse-field",
43-
"schemaVersion": "1.0.5",
44-
"hasCpSettings": false,
45-
"hasCpSection": false,
46-
"changelogUrl": "https://github.com/besteadfast/craft-preparse-field/blob/master/CHANGELOG.md",
47-
"components": {
48-
"preparseFieldService": "besteadfast\\preparsefield\\services\\PreparseFieldService"
49-
},
50-
"class": "besteadfast\\preparsefield\\PreparseField"
43+
"class": "jalendport\\preparse\\PreparseField"
5144
}
5245
}

src/PreparseField.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<?php
22
/**
33
* Preparse Field plugin for Craft CMS 4.x
4-
*
5-
* @link https://www.steadfastdesignfirm.com/
6-
* @copyright Copyright (c) Steadfast Design Firm
74
*/
85

9-
namespace besteadfast\preparsefield;
6+
namespace jalendport\preparse;
107

11-
use besteadfast\preparsefield\fields\PreparseFieldType;
12-
use besteadfast\preparsefield\services\PreparseFieldService as PreparseFieldServiceService;
8+
use jalendport\preparse\fields\PreparseFieldType;
9+
use jalendport\preparse\services\PreparseFieldService;
1310
use Craft;
1411
use craft\base\Element;
1512
use craft\base\Plugin;
@@ -29,14 +26,13 @@
2926
/**
3027
* Preparse field plugin
3128
*
32-
* @author Steadfast Design Firm
33-
* @package PreparseField
34-
* @since 1.0.0
35-
*
36-
* @property PreparseFieldServiceService $preparseFieldService
29+
* @property PreparseFieldService $preparseFieldService
3730
*/
3831
class PreparseField extends Plugin
3932
{
33+
34+
public string $schemaVersion = '1.1.0';
35+
4036
/**
4137
* Static property that is an instance of this plugin class so that it can be accessed via
4238
* PreparseField::$plugin
@@ -116,7 +112,7 @@ function (ModelEvent $event) {
116112
}
117113

118114
$key = $element->id . '__' . $element->siteId;
119-
115+
120116
if (!isset($this->preparsedElements['onPropagate'][$key])) {
121117
$this->preparsedElements['onPropagate'][$key] = true;
122118

@@ -204,7 +200,7 @@ public static function error($msg, string $level = 'error', string $file = 'Prep
204200
/**
205201
* Fix file uploads being processed twice by craft, which causes an error.
206202
*
207-
* @see https://github.com/besteadfast/craft-preparse-field/issues/23#issuecomment-284682292
203+
* @see https://github.com/jalendport/craft-preparse/issues/23#issuecomment-284682292
208204
*/
209205
private function resetUploads()
210206
{

src/fields/PreparseFieldType.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<?php
22
/**
33
* Preparse Field plugin for Craft CMS 4.x
4-
*
5-
* @link https://www.steadfastdesignfirm.com/
6-
* @copyright Copyright (c) Steadfast Design Firm
74
*/
85

9-
namespace besteadfast\preparsefield\fields;
6+
namespace jalendport\preparse\fields;
107

118
use Craft;
129
use craft\base\ElementInterface;
@@ -28,11 +25,7 @@
2825
use yii\base\InvalidConfigException;
2926

3027
/**
31-
* Preparse field type
32-
*
33-
* @author Steadfast Design Firm
34-
* @package PreparseField
35-
* @since 1.0.0
28+
* Preparse field type
3629
*
3730
* @property string $contentColumnType
3831
* @property null|string $settingsHtml

src/migrations/m190226_225259_craft3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace besteadfast\preparsefield\migrations;
3+
namespace jalendport\preparse\migrations;
44

5-
use besteadfast\preparsefield\fields\PreparseFieldType;
5+
use jalendport\preparse\fields\PreparseFieldType;
66
use craft\db\Migration;
77

88
/**
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
namespace jalendport\preparse\migrations;
4+
5+
use Craft;
6+
use craft\db\Migration;
7+
use jalendport\preparse\fields\PreparseFieldType;
8+
use yii\base\ErrorException;
9+
use yii\base\Exception;
10+
11+
/**
12+
* m240711_230833_jalendport migration.
13+
*/
14+
class m240711_230833_jalendport extends Migration
15+
{
16+
/**
17+
* @inheritdoc
18+
*/
19+
public function safeUp(): bool
20+
{
21+
$oldType = 'besteadfast\preparsefield\fields\PreparseFieldType';
22+
23+
$this->update('{{%fields}}', ['type'=> PreparseFieldType::class], ['type' => $oldType]);
24+
25+
// Don’t make the same config changes twice
26+
$projectConfig = Craft::$app->getProjectConfig();
27+
$schemaVersion = $projectConfig->get('plugins.preparse-field.schemaVersion', true);
28+
29+
if (version_compare($schemaVersion, '1.1.0', '>='))
30+
{
31+
return true;
32+
}
33+
34+
$fields = $projectConfig->get('fields') ?? [];
35+
36+
foreach ($fields as $fieldUid => $field)
37+
{
38+
if ($field['type'] === $oldType)
39+
{
40+
$field['type'] = PreparseFieldType::class;
41+
try {
42+
$projectConfig->set("fields.{$fieldUid}", $field);
43+
} catch (Exception|ErrorException $e) {
44+
return false;
45+
}
46+
}
47+
}
48+
49+
return true;
50+
}
51+
52+
/**
53+
* @inheritdoc
54+
*/
55+
public function safeDown(): bool
56+
{
57+
echo "m240711_230833_jalendport cannot be reverted.\n";
58+
return false;
59+
}
60+
}

src/services/PreparseFieldService.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
<?php
22
/**
33
* Preparse Field plugin for Craft CMS 4.x
4-
*
5-
* @link https://www.steadfastdesignfirm.com/
6-
* @copyright Copyright (c) Steadfast Design Firm
74
*/
85

9-
namespace besteadfast\preparsefield\services;
6+
namespace jalendport\preparse\services;
107

11-
use besteadfast\preparsefield\fields\PreparseFieldType;
8+
use jalendport\preparse\fields\PreparseFieldType;
129
use Craft;
1310
use craft\base\Component;
1411
use craft\base\Element;
@@ -26,10 +23,6 @@
2623
* and other plugins can interact with.
2724
*
2825
* https://craftcms.com/docs/plugins/services
29-
*
30-
* @author Steadfast Design Firm
31-
* @package PreparseField
32-
* @since 1.0.0
3326
*/
3427
class PreparseFieldService extends Component
3528
{

src/templates/_components/fields/_input.twig

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
/**
33
* Preparse Field plugin for Craft CMS 4.x
44
*
5-
* Field Input
6-
*
7-
* @author Steadfast Design Firm
8-
* @copyright Copyright (c) Steadfast Design Firm
9-
* @link https://www.steadfastdesignfirm.com/
10-
* @package PreparseField
11-
* @since 1.0.0
5+
* Field Input
126
*/
137
#}
148

0 commit comments

Comments
 (0)