Skip to content

Commit 7d6c6d9

Browse files
authored
Merge pull request #27 from davidwebca/master
Upgrading for Craft 4.0
2 parents fa6b3d0 + d0962ff commit 7d6c6d9

5 files changed

Lines changed: 13 additions & 11 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
],
2424
"require": {
25-
"craftcms/cms": "^3.0.0-RC17"
25+
"craftcms/cms": "^4.0"
2626
},
2727
"autoload": {
2828
"psr-4": {

src/TagManager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ class TagManager extends Plugin
4141
// Properties
4242
// =========================================================================
4343

44-
public $schemaVersion = '1.0.0';
44+
public string $schemaVersion = '1.0.0';
4545

46-
public $hasCpSettings = true;
46+
public bool $hasCpSettings = true;
4747

48-
public $hasCpSection = true;
48+
public bool $hasCpSection = true;
4949

5050
// Init
5151
// =========================================================================
@@ -88,7 +88,7 @@ public function init ()
8888
// Craft
8989
// =========================================================================
9090

91-
public function getCpNavItem ()
91+
public function getCpNavItem (): ?array
9292
{
9393
$item = parent::getCpNavItem();
9494

@@ -106,7 +106,7 @@ protected function createSettingsModel (): Settings
106106
/**
107107
* @return bool|Model|null
108108
*/
109-
public function getSettings ()
109+
public function getSettings (): ?Model
110110
{
111111
return parent::getSettings();
112112
}
@@ -117,7 +117,7 @@ public function getSettings ()
117117
* @throws RuntimeError
118118
* @throws SyntaxError|Exception
119119
*/
120-
protected function settingsHtml ()
120+
protected function settingsHtml (): ?string
121121
{
122122
return Craft::$app->getView()->renderTemplate('tag-manager/_settings', [
123123
'settings' => $this->getSettings(),

src/elements/Tag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Tag extends \craft\elements\Tag
3737
// Methods
3838
// =========================================================================
3939

40-
public static function find (): ElementQueryInterface
40+
public static function find (): TagQuery
4141
{
4242
return new TagQuery(static::class);
4343
}
@@ -46,7 +46,7 @@ public static function find (): ElementQueryInterface
4646
* @return null|string
4747
* @throws InvalidConfigException
4848
*/
49-
public function getCpEditUrl ()
49+
public function getCpEditUrl (): ?string
5050
{
5151
$url = UrlHelper::cpUrl(
5252
'tags/' . $this->group->handle . '/' . $this->id

src/elements/actions/Delete.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getTriggerLabel (): string
5353
* @throws \yii\base\Exception
5454
* @throws InvalidConfigException
5555
*/
56-
public function getTriggerHtml ()
56+
public function getTriggerHtml (): ?string
5757
{
5858
$type = Json::encode(static::class);
5959
$redirect = Json::encode(Craft::$app->security->hashData('tags'));
@@ -101,6 +101,8 @@ function(response, textStatus) {
101101

102102
Craft::$app->view->registerAssetBundle(DeleteTagAsset::class);
103103
Craft::$app->view->registerJs($js);
104+
105+
return '';
104106
}
105107

106108
/**

src/templates/_edit.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
}) }}
108108

109109
{% include "_includes/fields" with {
110-
fields: tag.group.getFieldLayout().getFields(),
110+
fields: tag.group.getFieldLayout().getCustomFields(),
111111
element: tag,
112112
} only %}
113113
</div>

0 commit comments

Comments
 (0)