Skip to content

Commit

Permalink
Merge pull request #27 from davidwebca/master
Browse files Browse the repository at this point in the history
Upgrading for Craft 4.0
  • Loading branch information
Tam authored Oct 31, 2022
2 parents fa6b3d0 + d0962ff commit 7d6c6d9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-RC17"
"craftcms/cms": "^4.0"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 6 additions & 6 deletions src/TagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class TagManager extends Plugin
// Properties
// =========================================================================

public $schemaVersion = '1.0.0';
public string $schemaVersion = '1.0.0';

public $hasCpSettings = true;
public bool $hasCpSettings = true;

public $hasCpSection = true;
public bool $hasCpSection = true;

// Init
// =========================================================================
Expand Down Expand Up @@ -88,7 +88,7 @@ public function init ()
// Craft
// =========================================================================

public function getCpNavItem ()
public function getCpNavItem (): ?array
{
$item = parent::getCpNavItem();

Expand All @@ -106,7 +106,7 @@ protected function createSettingsModel (): Settings
/**
* @return bool|Model|null
*/
public function getSettings ()
public function getSettings (): ?Model
{
return parent::getSettings();
}
Expand All @@ -117,7 +117,7 @@ public function getSettings ()
* @throws RuntimeError
* @throws SyntaxError|Exception
*/
protected function settingsHtml ()
protected function settingsHtml (): ?string
{
return Craft::$app->getView()->renderTemplate('tag-manager/_settings', [
'settings' => $this->getSettings(),
Expand Down
4 changes: 2 additions & 2 deletions src/elements/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Tag extends \craft\elements\Tag
// Methods
// =========================================================================

public static function find (): ElementQueryInterface
public static function find (): TagQuery
{
return new TagQuery(static::class);
}
Expand All @@ -46,7 +46,7 @@ public static function find (): ElementQueryInterface
* @return null|string
* @throws InvalidConfigException
*/
public function getCpEditUrl ()
public function getCpEditUrl (): ?string
{
$url = UrlHelper::cpUrl(
'tags/' . $this->group->handle . '/' . $this->id
Expand Down
4 changes: 3 additions & 1 deletion src/elements/actions/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getTriggerLabel (): string
* @throws \yii\base\Exception
* @throws InvalidConfigException
*/
public function getTriggerHtml ()
public function getTriggerHtml (): ?string
{
$type = Json::encode(static::class);
$redirect = Json::encode(Craft::$app->security->hashData('tags'));
Expand Down Expand Up @@ -101,6 +101,8 @@ function(response, textStatus) {

Craft::$app->view->registerAssetBundle(DeleteTagAsset::class);
Craft::$app->view->registerJs($js);

return '';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/templates/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
}) }}

{% include "_includes/fields" with {
fields: tag.group.getFieldLayout().getFields(),
fields: tag.group.getFieldLayout().getCustomFields(),
element: tag,
} only %}
</div>
Expand Down

0 comments on commit 7d6c6d9

Please sign in to comment.