Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Craft 4 port. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

* Initial Craft 4 support

## 1.0.3 - 2018-05-18

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<p align="left"><a href="https://github.com/fruitstudios/craft-validateit" target="_blank"><img width="100" height="100" src="resources/img/validateit.svg" alt="Validateit"></a></p>

# Validateit plugin for Craft 3
# Validateit plugin for Craft 4

Supercharged text field validation...

### Requirements

This plugin requires Craft CMS 3.0.0 or later.
This plugin requires Craft CMS 4.0.0 or later.

### Installation

Expand Down
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": "fruitstudios/validateit",
"description": "Supercharged text field validation.",
"type": "craft-plugin",
"version": "1.0.3",
"version": "2.0.0-dev",
"keywords": [
"craft",
"cms",
Expand All @@ -23,7 +23,7 @@
}
],
"require": {
"craftcms/cms": "^3.0.2"
"craftcms/cms": "^4.0.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/Validateit.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Validateit plugin for Craft CMS 3.x
* Validateit plugin for Craft CMS 4.x
*
* A super simple field type which allows you toggle existing field types.
*
Expand Down Expand Up @@ -43,7 +43,7 @@ class Validateit extends Plugin
/**
* @var string
*/
public $schemaVersion = '1.0.0';
public string $schemaVersion = '2.0.0';

// Public Methods
// =========================================================================
Expand Down
12 changes: 6 additions & 6 deletions src/fields/ValidateitField.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Validateit plugin for Craft CMS 3.x
* Validateit plugin for Craft CMS 4.x
*
* A super simple field type which allows you toggle existing field types.
*
Expand Down Expand Up @@ -47,7 +47,7 @@ public static function displayName(): string
// Public Methods
// =========================================================================

public function rules()
public function rules(): array
{
$rules = parent::rules();
$rules[] = [['type'], 'required'];
Expand Down Expand Up @@ -123,20 +123,20 @@ public function getContentColumnType(): string
return Schema::TYPE_TEXT;
}

public function normalizeValue($value, ElementInterface $element = null)
public function normalizeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed
{
return $value;
}

public function serializeValue($value, ElementInterface $element = null)
public function serializeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed
{
return parent::serializeValue($value, $element);
}

/**
* @inheritdoc
*/
public function getSettingsHtml()
public function getSettingsHtml(): ?string
{
// Render the settings template
return Craft::$app->getView()->renderTemplate(
Expand All @@ -150,7 +150,7 @@ public function getSettingsHtml()
/**
* @inheritdoc
*/
public function getInputHtml($value, ElementInterface $element = null): string
public function getInputHtml(mixed $value, ?\craft\base\ElementInterface $element = null): string
{
// Get our id and namespace
$id = Craft::$app->getView()->formatInputId($this->handle);
Expand Down
2 changes: 1 addition & 1 deletion src/translations/en/validateit.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Validateit plugin for Craft CMS 3.x
* Validateit plugin for Craft CMS 4.x
*
* A super simple field type which allows you toggle existing field types.
*
Expand Down