Skip to content

Commit

Permalink
Added Craft 4+ support
Browse files Browse the repository at this point in the history
  • Loading branch information
bhashkar007 committed Dec 29, 2022
1 parent 0565013 commit f246466
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "by/first-image",
"description": "A plugin to get first image from Redactor Field.",
"type": "craft-plugin",
"version": "1.1.0",
"version": "2.0.0",
"keywords": [
"craft",
"cms",
Expand All @@ -22,7 +22,7 @@
}
],
"require": {
"craftcms/cms": "^3.0.0"
"craftcms/cms": "^4.0.0"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 5 additions & 5 deletions src/FirstImage.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* First Image plugin for Craft CMS 3.x
* First Image plugin for Craft CMS 4.x
*
* A plugin to get first image from Redactor Field.
* A plugin to get first image from Redactor Field.
*
* @link http://sidd3.com
* @link https://360adaptive.com
* @copyright Copyright (c) 2018 Bhashkar Yadav
*/

Expand All @@ -24,7 +24,7 @@
*
* @author Bhashkar Yadav
* @package FirstImage
* @since 1.0.0
* @since 2.0.0
*
*/
class FirstImage extends Plugin
Expand All @@ -43,7 +43,7 @@ class FirstImage extends Plugin
/**
* @var string
*/
public $schemaVersion = '1.0.0';
public string $schemaVersion = '1.0.0';

// Public Methods
// =========================================================================
Expand Down
8 changes: 4 additions & 4 deletions src/translations/en/first-image.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
/**
* First Image plugin for Craft CMS 3.x
* First Image plugin for Craft CMS 4.x
*
* A plugin to get first image from Redactor Field.
* A plugin to get first image from Redactor Field.
*
* @link http://sidd3.com
* @link https://360adaptive.com
* @copyright Copyright (c) 2018 Bhashkar Yadav
*/

/**
* @author Bhashkar Yadav
* @package FirstImage
* @since 1.0.0
* @since 2.0.0
*/
return [
'First Image plugin loaded' => 'First Image plugin loaded',
Expand Down
14 changes: 7 additions & 7 deletions src/twigextensions/FirstImageTwigExtension.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* First Image plugin for Craft CMS 3.x
* First Image plugin for Craft CMS 4.x
*
* A plugin to get first image from Redactor Field.
* A plugin to get first image from Redactor Field.
*
* @link http://sidd3.com
* @link https://360adaptive.com
* @copyright Copyright (c) 2018 Bhashkar Yadav
*/

Expand All @@ -18,9 +18,9 @@
/**
* @author Bhashkar Yadav
* @package FirstImage
* @since 1.0.0
* @since 2.0.0
*/
class FirstImageTwigExtension extends \Twig_Extension
class FirstImageTwigExtension extends \Twig\Extension\AbstractExtension
{
// Public Methods
// =========================================================================
Expand All @@ -39,7 +39,7 @@ public function getName()
public function getFilters()
{
return [
new \Twig_SimpleFilter('getFirstImage', [$this, 'get_first_image']),
new \Twig\TwigFilter('getFirstImage', [$this, 'get_first_image']),
];
}

Expand All @@ -49,7 +49,7 @@ public function getFilters()
public function getFunctions()
{
return [
new \Twig_SimpleFunction('getFirstImage', [$this, 'get_first_image']),
new \Twig\TwigFunction('getFirstImage', [$this, 'get_first_image']),
];
}

Expand Down

0 comments on commit f246466

Please sign in to comment.