diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa78be..e34e514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Searchit Changelog -> Configure powerful custom filters for an enhanced search experience in the Craft CMS control panel for [Craft 3](http://craftcms.com) +> Configure powerful custom filters for an enhanced search experience in the Craft CMS control panel for [Craft 4](http://craftcms.com) + +## 2.0.0 - 2022-11-04 + +### Added + +* Added - CraftCMS ^4.0.0 compatibility. ## 1.0.8 - 2019-05-16 diff --git a/README.html b/README.html deleted file mode 100644 index 79e33a9..0000000 --- a/README.html +++ /dev/null @@ -1,1079 +0,0 @@ -README

Searchit

- -

Searchit plugin for Craft CMS 3

-

Configure powerful custom filters for enhanced search in the Craft CP.

-

This plugin gives your CP users an extensive tool for searching/ filtering entries, categories, assets and users in the CP.

-

Uses and extends the Craft CP element search

-

Examples

-

You have two ways to setup filters. Manually or dynamically.

-

Assets

-
-
- -

Entries

-
-
- -

Categories

-
-
- -

Tip: As with the regular Craft Search, if you suspect that your search indexes don’t have the latest and greatest data, you can have Craft rebuild them with the Rebuild Search Indexes tool in Settings.

-

Brought to you by Fruit Studios

\ No newline at end of file diff --git a/README.md b/README.md index 5406a21..667c9dd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -

Searchit

+

Searchit

-# Searchit plugin for Craft CMS 3 +# Searchit plugin for Craft CMS 4.x Configure powerful custom filters for an enhanced search experience in the Craft CMS control panel. Harness the power of twig and element queries to create endless filtering options. Keep your clients happy! @@ -11,7 +11,7 @@ See it in action... ## Requirements -This plugin requires Craft CMS 3.1.2 or later. +This plugin requires Craft CMS 4.0.0 or later. ## Installation @@ -151,7 +151,7 @@ Support for Commerce coming very soon #### Useful Resources Craft CMS Search Documentation [Docs](https://docs.craftcms.com/v3/searching.html) -As with the regular Craft Search, if you suspect that your search indexes don’t have the latest and greatest data, you can have Craft rebuild them with the Rebuild Search Indexes tool in Settings. [Docs](https://docs.craftcms.com/v3/searching.html#rebuilding-your-search-indexes) +As with the regular Craft Search, if you suspect that your search indexes don’t have the latest and greatest data, you can have Craft rebuild them with the Rebuild Search Indexes tool in Settings. [Docs](https://craftcms.com/docs/4.x/searching.html#rebuilding-your-search-indexes) Brought to you by [FRUIT](https://fruitstudios.co.uk) diff --git a/composer.json b/composer.json index 4f2cfbc..a8304c1 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,6 @@ "name": "fruitstudios/searchit", "description": "Configure powerful custom filters for an enhanced search experience in the Craft CMS control panel.", "type": "craft-plugin", - "version": "1.0.8", "keywords": [ "craft", "cms", @@ -16,8 +15,8 @@ "elements" ], "support": { - "docs": "https://github.com/fruitstudios/craft-searchit/blob/master/README.md", - "issues": "https://github.com/fruitstudios/craft-searchit/issues" + "docs": "https://github.com/presseddigital/searchit/blob/master/README.md", + "issues": "https://github.com/presseddigital/searchit/issues" }, "license": "proprietary", "authors": [ @@ -27,7 +26,7 @@ } ], "require": { - "craftcms/cms": "^3.1.2" + "craftcms/cms": "^4.0.0" }, "autoload": { "psr-4": { @@ -39,7 +38,7 @@ "handle": "searchit", "hasCpSettings": true, "hasCpSection": false, - "changelogUrl": "https://raw.githubusercontent.com/fruitstudios/craft-searchit/master/CHANGELOG.md", + "changelogUrl": "https://raw.githubusercontent.com/presseddigital/searchit/master/CHANGELOG.md", "class": "fruitstudios\\searchit\\Searchit" } } diff --git a/src/Searchit.php b/src/Searchit.php index 1a0a748..c2be77b 100644 --- a/src/Searchit.php +++ b/src/Searchit.php @@ -1,6 +1,6 @@ $this->name]), __METHOD__); } - public function beforeInstall(): bool - { - return true; - } - public function afterInstallPlugin(PluginEvent $event) { $isCpRequest = Craft::$app->getRequest()->isCpRequest; @@ -116,7 +111,7 @@ public function afterInstallPlugin(PluginEvent $event) } } - public function getSettingsResponse() + public function getSettingsResponse(): mixed { return Craft::$app->controller->redirect(UrlHelper::cpUrl('searchit/settings')); } @@ -190,7 +185,7 @@ public function initElementFilters() // Protected Methods // ========================================================================= - protected function createSettingsModel() + protected function createSettingsModel(): ?craft\base\Model { return new Settings(); } diff --git a/src/controllers/ElementFiltersController.php b/src/controllers/ElementFiltersController.php index db47ee2..cbdf4ac 100644 --- a/src/controllers/ElementFiltersController.php +++ b/src/controllers/ElementFiltersController.php @@ -8,9 +8,8 @@ use Craft; use craft\web\Controller; -use craft\helpers\StringHelper; use craft\helpers\Json; - +use yii\web\HttpException; use yii\web\Response; class ElementFiltersController extends Controller @@ -141,7 +140,7 @@ public function actionDelete(): Response { return $this->asJson(['success' => true]); } - return $this->asErrorJson(Craft::t('searchit', 'Could not delete element filter')); + return $this->asFailure(Craft::t('searchit', 'Could not delete element filter')); } public function actionReorder(): Response diff --git a/src/models/ElementFilter.php b/src/models/ElementFilter.php index 462757f..2c6c191 100644 --- a/src/models/ElementFilter.php +++ b/src/models/ElementFilter.php @@ -37,6 +37,7 @@ public function rules(): array public function validateSettings() { + /** @var craft\web\View $view */ $view = Craft::$app->getView(); $currentTemplateMode = $view->getTemplateMode(); $view->setTemplateMode($view::TEMPLATE_MODE_SITE); @@ -167,6 +168,7 @@ public function getOptions() break; case 'dynamic': + /** @var craft\web\View $view */ $view = Craft::$app->getView(); $currentTemplateMode = $view->getTemplateMode(); $view->setTemplateMode($view::TEMPLATE_MODE_SITE); @@ -191,12 +193,10 @@ public function getOptions() public function getPreview() { - return Craft::$app->getView()->renderTemplateMacro('_includes/forms', 'select', [ + return Craft::$app->getView()->renderObjectTemplate('_includes/forms', 'select', [ [ 'options' => $this->getOptions(), ] ]); } - - } diff --git a/src/services/ElementFilters.php b/src/services/ElementFilters.php index 583fe87..720e91e 100644 --- a/src/services/ElementFilters.php +++ b/src/services/ElementFilters.php @@ -20,6 +20,7 @@ use craft\commerce\elements\Product; use craft\commerce\Plugin as CommercePlugin; +use Exception; class ElementFilters extends Component { @@ -132,7 +133,7 @@ public function getSupportedSources(string $elementType) 'handle' => self::GLOBAL_SOURCE_HANDLE, ]; - $allSources = Craft::$app->getElementIndexes()->getSources($elementType); + $allSources = Craft::$app->getElementSources()->getSources($elementType); if($allSources) { foreach ($allSources as $source) diff --git a/src/translations/en/searchit.php b/src/translations/en/searchit.php index 5f5caac..859f0c8 100644 --- a/src/translations/en/searchit.php +++ b/src/translations/en/searchit.php @@ -1,6 +1,6 @@