Skip to content

Commit f246466

Browse files
committed
Added Craft 4+ support
1 parent 0565013 commit f246466

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "by/first-image",
33
"description": "A plugin to get first image from Redactor Field.",
44
"type": "craft-plugin",
5-
"version": "1.1.0",
5+
"version": "2.0.0",
66
"keywords": [
77
"craft",
88
"cms",
@@ -22,7 +22,7 @@
2222
}
2323
],
2424
"require": {
25-
"craftcms/cms": "^3.0.0"
25+
"craftcms/cms": "^4.0.0"
2626
},
2727
"autoload": {
2828
"psr-4": {

src/FirstImage.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
/**
3-
* First Image plugin for Craft CMS 3.x
3+
* First Image plugin for Craft CMS 4.x
44
*
5-
* A plugin to get first image from Redactor Field.
5+
* A plugin to get first image from Redactor Field.
66
*
7-
* @link http://sidd3.com
7+
* @link https://360adaptive.com
88
* @copyright Copyright (c) 2018 Bhashkar Yadav
99
*/
1010

@@ -24,7 +24,7 @@
2424
*
2525
* @author Bhashkar Yadav
2626
* @package FirstImage
27-
* @since 1.0.0
27+
* @since 2.0.0
2828
*
2929
*/
3030
class FirstImage extends Plugin
@@ -43,7 +43,7 @@ class FirstImage extends Plugin
4343
/**
4444
* @var string
4545
*/
46-
public $schemaVersion = '1.0.0';
46+
public string $schemaVersion = '1.0.0';
4747

4848
// Public Methods
4949
// =========================================================================

src/translations/en/first-image.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?php
22
/**
3-
* First Image plugin for Craft CMS 3.x
3+
* First Image plugin for Craft CMS 4.x
44
*
5-
* A plugin to get first image from Redactor Field.
5+
* A plugin to get first image from Redactor Field.
66
*
7-
* @link http://sidd3.com
7+
* @link https://360adaptive.com
88
* @copyright Copyright (c) 2018 Bhashkar Yadav
99
*/
1010

1111
/**
1212
* @author Bhashkar Yadav
1313
* @package FirstImage
14-
* @since 1.0.0
14+
* @since 2.0.0
1515
*/
1616
return [
1717
'First Image plugin loaded' => 'First Image plugin loaded',

src/twigextensions/FirstImageTwigExtension.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
/**
3-
* First Image plugin for Craft CMS 3.x
3+
* First Image plugin for Craft CMS 4.x
44
*
5-
* A plugin to get first image from Redactor Field.
5+
* A plugin to get first image from Redactor Field.
66
*
7-
* @link http://sidd3.com
7+
* @link https://360adaptive.com
88
* @copyright Copyright (c) 2018 Bhashkar Yadav
99
*/
1010

@@ -18,9 +18,9 @@
1818
/**
1919
* @author Bhashkar Yadav
2020
* @package FirstImage
21-
* @since 1.0.0
21+
* @since 2.0.0
2222
*/
23-
class FirstImageTwigExtension extends \Twig_Extension
23+
class FirstImageTwigExtension extends \Twig\Extension\AbstractExtension
2424
{
2525
// Public Methods
2626
// =========================================================================
@@ -39,7 +39,7 @@ public function getName()
3939
public function getFilters()
4040
{
4141
return [
42-
new \Twig_SimpleFilter('getFirstImage', [$this, 'get_first_image']),
42+
new \Twig\TwigFilter('getFirstImage', [$this, 'get_first_image']),
4343
];
4444
}
4545

@@ -49,7 +49,7 @@ public function getFilters()
4949
public function getFunctions()
5050
{
5151
return [
52-
new \Twig_SimpleFunction('getFirstImage', [$this, 'get_first_image']),
52+
new \Twig\TwigFunction('getFirstImage', [$this, 'get_first_image']),
5353
];
5454
}
5555

0 commit comments

Comments
 (0)