Skip to content

Commit

Permalink
Fix compatibility issue with Gatsby Helper
Browse files Browse the repository at this point in the history
Fixes #20
  • Loading branch information
Tam committed Oct 7, 2021
1 parent cfc15a3 commit fa6b3d0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.9 - 2021-09-07
### Fixed
- Fix compatibility issue with Gatsby Helper (Fixes #20)

## 1.0.8 - 2021-09-04
### Fixed
- Fix tags not being listed on index (Fixes #18, via @stevecomrie)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ether/tags",
"description": "A tag manager for Craft 3",
"type": "craft-plugin",
"version": "1.0.8",
"version": "1.0.9",
"keywords": [
"craft",
"cms",
Expand Down
23 changes: 20 additions & 3 deletions src/TagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@

use Craft;
use craft\base\Element;
use craft\base\Model;
use craft\base\Plugin;
use craft\elements\actions\Edit;
use craft\events\RegisterCpNavItemsEvent;
use craft\events\RegisterElementActionsEvent;
use craft\events\RegisterUrlRulesEvent;
use craft\gatsbyhelper\events\RegisterIgnoredTypesEvent;
use craft\gatsbyhelper\services\Deltas;
use craft\web\twig\variables\Cp;
use craft\web\UrlManager;
use ether\tagManager\elements\actions\Delete;
Expand All @@ -24,6 +27,7 @@
use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError;
use yii\base\Event;
use yii\base\Exception;

/**
* Class Tags
Expand Down Expand Up @@ -71,6 +75,14 @@ public function init ()
[$this, 'onRegisterCpNavItems']
);

if (class_exists(Deltas::class)) {
Event::on(
Deltas::class,
Deltas::EVENT_REGISTER_IGNORED_TYPES,
[$this, 'onRegisterIgnoredTypes']
);
}

}

// Craft
Expand All @@ -86,13 +98,13 @@ public function getCpNavItem ()
return $item;
}

protected function createSettingsModel ()
protected function createSettingsModel (): Settings
{
return new Settings();
}

/**
* @return bool|Settings|null
* @return bool|Model|null
*/
public function getSettings ()
{
Expand All @@ -103,7 +115,7 @@ public function getSettings ()
* @return string|null
* @throws LoaderError
* @throws RuntimeError
* @throws SyntaxError
* @throws SyntaxError|Exception
*/
protected function settingsHtml ()
{
Expand Down Expand Up @@ -162,4 +174,9 @@ public function onRegisterCpNavItems (RegisterCpNavItemsEvent $event)
$event->navItems = $navItems;
}

public function onRegisterIgnoredTypes (RegisterIgnoredTypesEvent $event)
{
$event->types[] = Tag::class;
}

}

0 comments on commit fa6b3d0

Please sign in to comment.