Skip to content

Commit

Permalink
Merge branch 'craft-3' of https://github.com/verbb/super-table into c…
Browse files Browse the repository at this point in the history
…raft-3
  • Loading branch information
engram-design committed Mar 27, 2023
2 parents 53e74ba + 64f719a commit 679aad3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/SuperTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use verbb\supertable\models\SuperTableBlockTypeModel;
use verbb\supertable\services\SuperTableService;
use verbb\supertable\variables\SuperTableVariable;
use verbb\supertable\migrations\Install;

use Craft;
use craft\base\Plugin;
Expand All @@ -29,6 +30,8 @@
use craft\gatsbyhelper\events\RegisterIgnoredTypesEvent;
use craft\gatsbyhelper\services\Deltas;

use craft\fixfks\controllers\RestoreController;

use yii\base\Event;

class SuperTable extends Plugin
Expand Down Expand Up @@ -144,6 +147,13 @@ private function _registerIntegrations()
$event->types[] = SuperTableBlockElement::class;
});
}

// Support Fix Fks - https://github.com/craftcms/fix-fks
if (class_exists(RestoreController::class)) {
Event::on(RestoreController::class, RestoreController::EVENT_AFTER_RESTORE_FKS, function(Event $event) {
(new Install)->addForeignKeys();
});
}
}

}
2 changes: 1 addition & 1 deletion src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function createIndexes()
$this->createIndex(null, '{{%supertableblocktypes}}', ['fieldLayoutId'], false);
}

protected function addForeignKeys()
public function addForeignKeys()
{
$this->addForeignKey(null, '{{%supertableblocks}}', ['fieldId'], '{{%fields}}', ['id'], 'CASCADE', null);
$this->addForeignKey(null, '{{%supertableblocks}}', ['id'], '{{%elements}}', ['id'], 'CASCADE', null);
Expand Down

0 comments on commit 679aad3

Please sign in to comment.