Skip to content

Commit 319231b

Browse files
committed
make php 8.1 compatible
1 parent 3eeb12b commit 319231b

File tree

6 files changed

+57
-13
lines changed

6 files changed

+57
-13
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
# Read-only Field Changelog
22

3-
## Unreleased
3+
## 1.0.2 - 2022-05-13
4+
5+
### Added
6+
7+
- Make the field sortable.
8+
- Make php 8.1 compatible.
9+
410
### Changed
11+
512
- Fixed background color of icon
613

714
## 1.0.1 - 2019-09-14
15+
816
### Added
17+
918
- Support for Feed-Me plugin
1019

1120
## 1.0.0 - 2019-04-06
21+
1222
### Added
23+
1324
- Initial release

composer.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codemonauts/craft-readonly-field",
33
"description": "Craft CMS plugin to add a simple, read-only plaintext field.",
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"type": "craft-plugin",
66
"keywords": [
77
"craft",
@@ -33,10 +33,7 @@
3333
},
3434
"extra": {
3535
"handle": "readonly",
36-
"class": "codemonauts\\readonly\\Readonly",
37-
"name": "Read-only Field",
38-
"description": "Simple, read-only plaintext field.",
39-
"hasCpSection": false,
40-
"hasSettings": false
36+
"class": "codemonauts\\readonly\\ReadonlyPlugin",
37+
"name": "Read-only Field"
4138
}
4239
}

src/Readonly.php renamed to src/ReadonlyPlugin.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
use craft\events\RegisterComponentTypesEvent;
77
use craft\services\Fields;
88
use yii\base\Event;
9-
use codemonauts\readonly\fields\Readonly as ReadonlyField;
10-
use codemonauts\readonly\feedme\Readonly as ReadonlyFeedme;
9+
use codemonauts\readonly\fields\ReadonlyField;
10+
use codemonauts\readonly\feedme\ReadonlyField as ReadonlyFeedme;
1111
use craft\feedme\events\RegisterFeedMeFieldsEvent;
1212
use craft\feedme\services\Fields as FeedMeFields;
1313

14-
class Readonly extends Plugin
14+
class ReadonlyPlugin extends Plugin
1515
{
16+
public $schemaVersion = '1.0.1';
17+
1618
public function init()
1719
{
1820
parent::init();

src/feedme/Readonly.php renamed to src/feedme/ReadonlyField.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
use craft\feedme\base\Field;
66
use craft\feedme\base\FieldInterface;
77

8-
class Readonly extends Field implements FieldInterface
8+
class ReadonlyField extends Field implements FieldInterface
99
{
1010
public static $name = 'Read-only Field';
11-
public static $class = 'codemonauts\readonly\fields\Readonly';
11+
public static $class = 'codemonauts\readonly\fields\ReadonlyField';
1212

1313
public function getMappingTemplate(): string
1414
{

src/fields/Readonly.php renamed to src/fields/ReadonlyField.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
use craft\base\ElementInterface;
77
use craft\base\Field;
88
use craft\base\PreviewableFieldInterface;
9+
use craft\base\SortableFieldInterface;
910
use LitEmoji\LitEmoji;
1011
use yii\db\Schema;
1112

12-
class Readonly extends Field implements PreviewableFieldInterface
13+
class ReadonlyField extends Field implements PreviewableFieldInterface, SortableFieldInterface
1314
{
1415
/**
1516
* @var string The type of database column the field should have in the content table
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace codemonauts\readonly\migrations;
4+
5+
use craft\db\Migration;
6+
use craft\db\Table;
7+
8+
/**
9+
* m220429_104217_change_class_name migration.
10+
*/
11+
class m220429_104217_change_class_name extends Migration
12+
{
13+
/**
14+
* @inheritdoc
15+
*/
16+
public function safeUp(): bool
17+
{
18+
$this->getDb()->createCommand()
19+
->update(Table::FIELDS, ['type' => 'codemonauts\readonly\fields\ReadonlyField'], ['type' => 'codemonauts\readonly\fields\Readonly'])
20+
->execute();
21+
22+
return true;
23+
}
24+
25+
/**
26+
* @inheritdoc
27+
*/
28+
public function safeDown(): bool
29+
{
30+
echo "m220429_104217_change_class_name cannot be reverted.\n";
31+
return false;
32+
}
33+
}

0 commit comments

Comments
 (0)