timmyomahony / craft-matrix-field-preview

Configure a screenshot preview for all your matrix field blocks, giving your clients a better publishing experience.
https://plugins.craftcms.com/matrix-field-preview
Other
16 stars 4 forks source link

Craft 5 Compatibility #126

Closed hmcleek closed 3 months ago

hmcleek commented 7 months ago

Is there a timeline for upgrading this plugin to Craft 5?

timmyomahony commented 6 months ago

On the way, hopefully in June. Apologies for lack of responses to date, more consistent dev will be happening again this month.

brettburwell commented 5 months ago

Very exciting to hear!

jacobgraf commented 4 months ago

Just checking back in on this. Any update on Craft 5 timeline? This plugin looks like exactly what I need for our longform content Matrix fields. Thanks!

timmyomahony commented 4 months ago

Hi @jacobgraf I've started development on it now, but there have been significant changes to the underlying Matrix Field in Craft 5 so it's taking a bit longer than anticipated. I'm excited to get the next version up and running though so there will hopefully be a beta version in the next couple of weeks

jacobgraf commented 4 months ago

@timmyomahony Awesome and thanks for the quick reply!

timmyomahony commented 3 months ago

Thanks for everyone's patience on this and apologies for the delay. I've released an initial Craft 5 version of the plugin now, version 5.0.0.

There are two important caveats to be aware of before upgrading:

  1. When updating to this version, your old titles, descriptions and images from the Craft 4 version will be deleted and need to be re-entered. This is unfortunately due to the changes in the underlying matrix field from Craft 4 to 5 (specifically the migration from "block types" to "entry types").
  2. At the moment, the plugin will only work with the "block" view for matrix fields, not the new "card" or "element index" view. I'll be adding for these views ASAP, but they require some changes on the Craft codebase side to be able to hook into their JavaScript behavior.

Please let me know of any issues encountered.

brettburwell commented 3 months ago

🎉 Awesome news!

Congrats on getting this out the door. I'm excited to use it.

IrateGod commented 3 months ago

Thanks for everyone's patience on this and apologies for the delay. I've released an initial Craft 5 version of the plugin now, version 5.0.0.

There are two important caveats to be aware of before upgrading:

  1. When updating to this version, your old titles, descriptions and images from the Craft 4 version will be deleted and need to be re-entered. This is unfortunately due to the changes in the underlying matrix field from Craft 4 to 5 (specifically the migration from "block types" to "entry types").
  2. At the moment, the plugin will only work with the "block" view for matrix fields, not the new "card" or "element index" view. I'll be adding for these views ASAP, but they require some changes on the Craft codebase side to be able to hook into their JavaScript behavior.

Please let me know of any issues encountered.

Hi, thanks for continuing to work on this plugin and getting a Craft 5 release ready. When upgrading one of our client's sites to Craft 5, on my local version, running php craft up produces an error when applying the appropriate migration. I've attached the stack trace below, let me know if you require any further input from me.


    > add foreign key fk_iysiarioivogkjyoklqmzmivqniiyaatmldy: {{%matrixfieldpreview_blocktypes_config}} (blockTypeId) references {{%entrytypes}} (id) ...Exception: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`db`.`#sql-alter-1-90`, CONSTRAINT `fk_iysiarioivogkjyoklqmzmivqniiyaatmldy` FOREIGN KEY (`blockTypeId`) REFERENCES `entrytypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
The SQL being executed was: ALTER TABLE `matrixfieldpreview_blocktypes_config` ADD CONSTRAINT `fk_iysiarioivogkjyoklqmzmivqniiyaatmldy` FOREIGN KEY (`blockTypeId`) REFERENCES `entrytypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE (/var/www/html/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE `ma...')
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute('ALTER TABLE `ma...')
#2 /var/www/html/vendor/yiisoft/yii2/db/Migration.php(478): yii\db\Command->execute()
#3 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(436): yii\db\Migration->addForeignKey('fk_iysiarioivog...', '{{%matrixfieldp...', 'blockTypeId', '{{%entrytypes}}', 'id', 'CASCADE', 'CASCADE')
#4 /var/www/html/vendor/weareferal/matrix-field-preview/src/migrations/m240804_214123_converted_blocktype_to_entrytype.php(19): craft\db\Migration->addForeignKey('fk_iysiarioivog...', '{{%matrixfieldp...', 'blockTypeId', '{{%entrytypes}}', 'id', 'CASCADE', 'CASCADE')
#5 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(50): weareferal\matrixfieldpreview\migrations\m240804_214123_converted_blocktype_to_entrytype->safeUp()
#6 /var/www/html/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): craft\db\Migration->up()
#7 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(382): yii\console\controllers\BaseMigrateController->migrateUp('m240804_214123_...')
#8 [internal function]: craft\console\controllers\MigrateController->actionAll()
#9 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#11 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('all', Array)
#12 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(195): yii\console\Controller->runAction('all', Array)
#13 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): craft\console\controllers\MigrateController->runAction('all', Array)
#14 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#15 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('migrate/all', Array)
#16 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(212): craft\console\Application->runAction('migrate/all', Array)
#17 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(207): yii\base\Controller->run('migrate/all', Array)
#18 /var/www/html/vendor/craftcms/cms/src/console/controllers/UpController.php(60): craft\console\Controller->run('migrate/all', Array)
#19 [internal function]: craft\console\controllers\UpController->actionIndex()
#20 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#21 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#22 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('', Array)
#23 /var/www/html/vendor/craftcms/cms/src/console/ControllerTrait.php(89): yii\console\Controller->runAction('', Array)
#24 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(216): craft\console\Controller->traitRunAction('', Array)
#25 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('', Array)
#26 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('up', Array)
#27 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('up', Array)
#28 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('up', Array)
#29 /var/www/html/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest(Object(craft\console\Request))
#30 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#31 /var/www/html/craft(13): yii\base\Application->run()
#32 {main}
*** failed to apply m240804_214123_converted_blocktype_to_entrytype (time: 0.041s)```
timmyomahony commented 3 months ago

Hi @IrateGod I've moved your issue to a separate thread here:

https://github.com/timmyomahony/craft-matrix-field-preview/issues/130