Skip to content

Commit

Permalink
Change ownership, add ownership migration, bump the schema version
Browse files Browse the repository at this point in the history
  • Loading branch information
jalendport committed Jul 12, 2024
1 parent 0616ed2 commit 00b0438
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 68 deletions.
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

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

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

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

## 1.2.5 - 2021-07-02
### Fixed
- 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))
- Fixed a bug causing missing Matrix blocks on elements in certain cases ([#69](https://github.com/besteadfast/craft-preparse-field/issues/69))
- 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))
- Fixed a bug causing missing Matrix blocks on elements in certain cases ([#69](https://github.com/jalendport/craft-preparse/issues/69))

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

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

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

## 1.2.1 - 2020-06-25
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Steadfast Design Firm
Copyright (c) Jalen Davenport

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:

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A fieldtype that parses Twig when an element is saved and saves the result as pl

This plugin requires Craft CMS 3.2.0 or later.

_The Craft 2 version can be found in the [craft2](https://github.com/besteadfast/craft-preparse-field/tree/craft2) branch_
_The Craft 2 version can be found in the [craft2](https://github.com/jalendport/craft-preparse/tree/craft2) branch_

## Installation

Expand All @@ -18,7 +18,7 @@ To install the plugin, follow these instructions.

2. Then tell Composer to load the plugin:

composer require besteadfast/craft-preparse-field
composer require jalendport/craft-preparse

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

Expand Down Expand Up @@ -84,4 +84,4 @@ The plugin is released under the MIT license, meaning you can do whatever you wa

## Changelog

See the [changelog file](https://github.com/besteadfast/craft-preparse-field/blob/master/CHANGELOG.md).
See the [changelog file](https://github.com/jalendport/craft-preparse/blob/master/CHANGELOG.md).
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "besteadfast/craft-preparse-field",
"name": "jalendport/craft-preparse",
"description": "A fieldtype that parses Twig when an element is saved and saves the result as plain text.",
"type": "craft-plugin",
"version": "1.4.1",
Expand All @@ -13,14 +13,14 @@
"twig"
],
"support": {
"docs": "https://github.com/besteadfast/craft-preparse-field/blob/master/README.md",
"issues": "https://github.com/besteadfast/craft-preparse-field/issues"
"docs": "https://github.com/jalendport/craft-preparse/blob/master/README.md",
"issues": "https://github.com/jalendport/craft-preparse/issues"
},
"license": "MIT",
"authors": [
{
"name": "Steadfast Design Firm",
"homepage": "https://www.steadfastdesignfirm.com/"
"name": "Jalen Davenport",
"homepage": "https://jalendport.com/"
},
{
"name": "André Elvan",
Expand All @@ -33,20 +33,20 @@
},
"autoload": {
"psr-4": {
"besteadfast\\preparsefield\\": "src/",
"jalendport\\preparse\\": "src/",
"aelvan\\preparsefield\\": "src_legacy/"
}
},
"extra": {
"name": "Preparse Field",
"handle": "preparse-field",
"schemaVersion": "1.0.5",
"schemaVersion": "1.1.0",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://github.com/besteadfast/craft-preparse-field/blob/master/CHANGELOG.md",
"changelogUrl": "https://github.com/jalendport/craft-preparse/blob/master/CHANGELOG.md",
"components": {
"preparseFieldService": "besteadfast\\preparsefield\\services\\PreparseFieldService"
"preparseFieldService": "jalendport\\preparse\\services\\PreparseFieldService"
},
"class": "besteadfast\\preparsefield\\PreparseField"
"class": "jalendport\\preparse\\PreparseField"
}
}
19 changes: 6 additions & 13 deletions src/PreparseField.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?php
/**
* Preparse Field plugin for Craft CMS 3.x
*
* @link https://www.steadfastdesignfirm.com/
* @copyright Copyright (c) Steadfast Design Firm
*/

namespace besteadfast\preparsefield;
namespace jalendport\preparse;

use besteadfast\preparsefield\fields\PreparseFieldType;
use besteadfast\preparsefield\services\PreparseFieldService as PreparseFieldServiceService;
use jalendport\preparse\fields\PreparseFieldType;
use jalendport\preparse\services\PreparseFieldService;

use Craft;
use craft\base\Element;
Expand All @@ -30,11 +27,7 @@
/**
* Preparse field plugin
*
* @author Steadfast Design Firm
* @package PreparseField
* @since 1.0.0
*
* @property PreparseFieldServiceService $preparseFieldService
* @property PreparseFieldService $preparseFieldService
*/
class PreparseField extends Plugin
{
Expand Down Expand Up @@ -117,7 +110,7 @@ function (ModelEvent $event) {
}

$key = $element->id . '__' . $element->siteId;

if (!isset($this->preparsedElements['onPropagate'][$key])) {
$this->preparsedElements['onPropagate'][$key] = true;

Expand Down Expand Up @@ -205,7 +198,7 @@ public static function error($msg, $level = 'error', $file = 'RecurringOrders')
/**
* Fix file uploads being processed twice by craft, which causes an error.
*
* @see https://github.com/besteadfast/craft-preparse-field/issues/23#issuecomment-284682292
* @see https://github.com/jalendport/craft-preparse/issues/23#issuecomment-284682292
*/
private function resetUploads()
{
Expand Down
9 changes: 1 addition & 8 deletions src/fields/PreparseFieldType.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php
/**
* Preparse Field plugin for Craft CMS 3.x
*
* @link https://www.steadfastdesignfirm.com/
* @copyright Copyright (c) Steadfast Design Firm
*/

namespace besteadfast\preparsefield\fields;
namespace jalendport\preparse\fields;

use Craft;
use craft\base\ElementInterface;
Expand All @@ -28,10 +25,6 @@
/**
* Preparse field type
*
* @author Steadfast Design Firm
* @package PreparseField
* @since 1.0.0
*
* @property string $contentColumnType
* @property null|string $settingsHtml
*/
Expand Down
4 changes: 2 additions & 2 deletions src/migrations/m190226_225259_craft3.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace besteadfast\preparsefield\migrations;
namespace jalendport\preparse\migrations;

use besteadfast\preparsefield\fields\PreparseFieldType;
use jalendport\preparse\fields\PreparseFieldType;
use craft\db\Migration;

/**
Expand Down
60 changes: 60 additions & 0 deletions src/migrations/m240711_230833_jalendport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace jalendport\preparse\migrations;

use Craft;
use craft\db\Migration;
use jalendport\preparse\fields\PreparseFieldType;
use yii\base\ErrorException;
use yii\base\Exception;

/**
* m240711_230833_jalendport migration.
*/
class m240711_230833_jalendport extends Migration
{
/**
* @inheritdoc
*/
public function safeUp(): bool
{
$oldType = 'besteadfast\preparsefield\fields\PreparseFieldType';

$this->update('{{%fields}}', ['type'=> PreparseFieldType::class], ['type' => $oldType]);

// Don’t make the same config changes twice
$projectConfig = Craft::$app->getProjectConfig();
$schemaVersion = $projectConfig->get('plugins.preparse-field.schemaVersion', true);

if (version_compare($schemaVersion, '1.1.0', '>='))
{
return true;
}

$fields = $projectConfig->get('fields') ?? [];

foreach ($fields as $fieldUid => $field)
{
if ($field['type'] === $oldType)
{
$field['type'] = PreparseFieldType::class;
try {
$projectConfig->set("fields.{$fieldUid}", $field);
} catch (Exception|ErrorException $e) {
return false;
}
}
}

return true;
}

/**
* @inheritdoc
*/
public function safeDown(): bool
{
echo "m240711_230833_jalendport cannot be reverted.\n";
return false;
}
}
13 changes: 3 additions & 10 deletions src/services/PreparseFieldService.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php
/**
* Preparse Field plugin for Craft CMS 3.x
*
* @link https://www.steadfastdesignfirm.com/
* @copyright Copyright (c) Steadfast Design Firm
*/

namespace besteadfast\preparsefield\services;
namespace jalendport\preparse\services;

use besteadfast\preparsefield\fields\PreparseFieldType;
use jalendport\preparse\fields\PreparseFieldType;

use Craft;
use craft\base\Component;
Expand All @@ -26,10 +23,6 @@
* and other plugins can interact with.
*
* https://craftcms.com/docs/plugins/services
*
* @author Steadfast Design Firm
* @package PreparseField
* @since 1.0.0
*/
class PreparseFieldService extends Component
{
Expand Down Expand Up @@ -69,7 +62,7 @@ public function getPreparseFieldsContent(Element $element, string $eventHandle):

return $content;
}

/**
* Parses field for a given element.
*
Expand Down
6 changes: 0 additions & 6 deletions src/templates/_components/fields/_input.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
* Preparse Field plugin for Craft CMS 3.x
*
* Field Input
*
* @author Steadfast Design Firm
* @copyright Copyright (c) Steadfast Design Firm
* @link https://www.steadfastdesignfirm.com/
* @package PreparseField
* @since 1.0.0
*/
#}

Expand Down
6 changes: 0 additions & 6 deletions src/templates/_components/fields/_settings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
* Preparse Field plugin for Craft CMS
*
* Field Settings
*
* @author Steadfast Design Firm
* @copyright Copyright (c) Steadfast Design Firm
* @link https://www.steadfastdesignfirm.com/
* @package PreparseField
* @since 1.0.0
*/
#}

Expand Down
2 changes: 1 addition & 1 deletion src_legacy/fields/PreparseFieldType.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

class_exists(\besteadfast\preparsefield\fields\PreparseFieldType::class);
class_exists(\jalendport\preparse\fields\PreparseFieldType::class);

0 comments on commit 00b0438

Please sign in to comment.