Skip to content

Commit

Permalink
Add Craft 4 compatibility; bump to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Apr 23, 2022
1 parent 0e3484b commit a034320
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 51 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.1.0 - 2022-04-23
### Added
- Adds Craft 4.0 compatibility

## 1.0.1 - 2020-09-01

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Instructions plugin for Craft CMS 3.x
# Instructions plugin for Craft CMS

Adds an _Instructions_ field type that can be used to render field instructions as native UI elements inside Matrix field layouts.

Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vaersaagod/instructions",
"description": "Adds an \"Instructions\" field type that can be used to render field instructions as native UI elements inside Matrix field layouts.",
"type": "craft-plugin",
"version": "1.0.1",
"version": "1.1.0",
"keywords": [
"craft",
"cms",
Expand All @@ -22,7 +22,8 @@
}
],
"require": {
"craftcms/cms": "^3.5.5"
"craftcms/cms": "^3.5.5|^4.0.0-beta.4",
"php": "^7.2.5|^8.0"
},
"autoload": {
"psr-4": {
Expand All @@ -32,6 +33,7 @@
"extra": {
"name": "Instructions",
"handle": "instructions",
"schemaVersion": "1.0.0",
"developer": "Værsågod AS",
"developerUrl": "https://vaersaagod.no",
"documentationUrl": "https://github.com/vaersaagod/instructions/blob/master/README.md",
Expand Down
47 changes: 2 additions & 45 deletions src/Instructions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Instructions plugin for Craft CMS 3.x
* Instructions plugin for Craft CMS
*
* Adds an _Instructions_ field type that can be used to render field instructions as native UI elements inside Matrix field layouts.
*
Expand All @@ -16,8 +16,6 @@
use craft\base\Plugin;
use craft\events\RegisterComponentTypesEvent;
use craft\services\Fields;
use craft\services\Plugins;
use craft\events\PluginEvent;

use yii\base\Event;

Expand All @@ -31,51 +29,13 @@
*/
class Instructions extends Plugin
{
// Static Properties
// =========================================================================

/**
* @var Instructions
*/
public static $plugin;

// Public Properties
// =========================================================================

/**
* @var string
*/
public $schemaVersion = '1.0.0';

/**
* @var bool
*/
public $hasCpSettings = false;

/**
* @var bool
*/
public $hasCpSection = false;

// Public Methods
// =========================================================================

/**
* @inheritdoc
*/
public function init()
public function init(): void
{
parent::init();
self::$plugin = $this;

Event::on(
Plugins::class,
Plugins::EVENT_AFTER_INSTALL_PLUGIN,
function (PluginEvent $event) {
if ($event->plugin === $this) {
}
}
);

Event::on(
Fields::class,
Expand All @@ -95,7 +55,4 @@ function (RegisterComponentTypesEvent $event) {
);
}

// Protected Methods
// =========================================================================

}
2 changes: 1 addition & 1 deletion src/fields/Instructions.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function hasContentColumn(): bool
/**
* @inheritdoc
*/
public function getSettingsHtml()
public function getSettingsHtml(): ?string
{
return Craft::$app->getView()->renderTemplate('instructions/_settings',
[
Expand Down
3 changes: 2 additions & 1 deletion src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Craft;
use craft\db\Migration;

use vaersaagod\instructions\fields\Instructions;

/**
Expand All @@ -15,7 +16,7 @@ class Install extends Migration
/**
* @inheritdoc
*/
public function safeUp()
public function safeUp(): bool
{
echo "> Migrating CP Field Instructions field type to Instructions...\n";

Expand Down
2 changes: 1 addition & 1 deletion src/translations/en/instructions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Instructions plugin for Craft CMS 3.x
* Instructions plugin for Craft CMS
*
* Adds an _Instructions_ field type that can be used to render field instructions as native UI elements inside Matrix field layouts.
*
Expand Down

0 comments on commit a034320

Please sign in to comment.