Skip to content

Commit

Permalink
Merge pull request #9 from moldedjelly/craft3-mj
Browse files Browse the repository at this point in the history
update
  • Loading branch information
smockensturm committed Mar 19, 2021
2 parents 2c9e75f + 6383ced commit f192d39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Slugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use craft\events\PluginEvent;
use craft\services\Elements;
use craft\web\twig\variables\CraftVariable;
use craft\helpers\ElementHelper;

use yii\base\Event;

Expand Down Expand Up @@ -85,9 +86,9 @@ function (PluginEvent $event) {
);

Event::on(Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function(Event $event){

// Only hash if element is entry and new entry
if ( ($event->element instanceof \craft\elements\Entry) && $event->isNew )
if ( ($event->element instanceof \craft\elements\Entry) && $event->isNew && !ElementHelper::isDraftOrRevision($event->element) )
{

// Get the settings
Expand Down

0 comments on commit f192d39

Please sign in to comment.