Skip to content

Commit

Permalink
Fix to run with Craft 3
Browse files Browse the repository at this point in the history
  • Loading branch information
marionnewlevant committed Jun 21, 2018
1 parent 6334101 commit 5dc2e32
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 27 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Match Input Changelog

## 2.0.1 - 2018-06-21
### Fixed
- Craft 3 changes (wasn't installing)
## 2.0.0 - 2017-10-22
### Added
- Initial release for Craft 3
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ Craft field type for text fields that match a regex pattern.

To install Match Input, follow these steps:

1. Open your terminal and go to your Craft project:
1. Install with Composer via `composer require marionnewlevant/match-input` from your project directory
2. Install plugin in the Craft Control Panel under Settings > Plugins

cd /path/to/project
or

2. Then tell Composer to load the plugin:

composer require marionnewlevant/match-input

3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Match Input.
1. Install via the Plugin Store

Match Input works on Craft 3.x.

Expand Down
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "marionnewlevant/match-input",
"description": "Craft field type for text fields that match a regex pattern",
"version": "2.0.0",
"version": "2.0.1",
"type": "craft-plugin",
"keywords": [
"craft", "craftcms", "craft-plugin", "match-input"
"craft", "craftcms", "craft-plugin", "match input"
],
"license": "MIT",
"authors": [
Expand All @@ -14,7 +14,6 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-beta.20"
},
"autoload": {
"psr-4": {
Expand All @@ -24,11 +23,11 @@
"extra": {
"name": "Match Input",
"handle": "match-input",
"version": "2.0.0",
"version": "2.0.1",
"schemaVersion": "1.0.0",
"hasCpSettings": false,
"hasSettings": false,
"hasCpSection": false,
"documentationUrl": "https://github.com/marionnewlevant/craft-match_input/blob/v2/README.md",
"changelogUrl": "https://raw.githubusercontent.com/marionnewlevant/craft-match_input/v2/CHANGELOG.md"
"documentationUrl": "https://github.com/marionnewlevant/craft3-match_input/blob/master/README.md",
"changelogUrl": "https://raw.githubusercontent.com/marionnewlevant/craft3-match_input/master/CHANGELOG.md"
}
}
14 changes: 4 additions & 10 deletions src/fields/MatchInputField.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function isValidRegex($object, $attribute)
$inputMask = $this->$object;
if (!self::validateRegex($inputMask))
{
$this->addError($object, Craft::t('match-input', 'Not a valid regex (missing delimiters?)'));
$this->addError($object, Craft::t('matchinput', 'Not a valid regex (missing delimiters?)'));
}
}

Expand All @@ -128,15 +128,9 @@ public function isValidRegex($object, $attribute)
public function getSettingsHtml()
{
return Craft::$app->getView()->renderTemplate(
'match-input'
. DIRECTORY_SEPARATOR
. '_components'
. DIRECTORY_SEPARATOR
. 'fields'
. DIRECTORY_SEPARATOR
. '_settings',
'match-input/_components/fields/MatchInputField_settings',
[
'field' => $this
'field' => $this
]
);
}
Expand All @@ -154,7 +148,7 @@ public function getInputHtml($value, ElementInterface $element = null): string
{

return Craft::$app->getView()->renderTemplate(
'match-input'. DIRECTORY_SEPARATOR . '_components'. DIRECTORY_SEPARATOR . 'fields'. DIRECTORY_SEPARATOR . '_input',
'match-input/_components/fields/MatchInputField_input',
[
'name' => $this->handle,
'value' => $value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% import "_includes/forms" as forms %}

{{ forms.textField({
label: "Input Mask"|t('match-input'),
label: "Input Mask"|t('matchinput'),
instructions: "regex pattern that the input must match. See [php manual](http://php.net/manual/en/reference.pcre.pattern.syntax.php) for syntax. Example: '/^\\d{5}(-\\d{4})?$/' to match a zip-code"|t('matchinput'),
id: 'inputMask',
name: 'inputMask',
Expand All @@ -25,8 +25,8 @@
}) }}

{{ forms.textField({
label: "Error Message"|t('match-input'),
instructions: "Error message when pattern does not match field"|t('match-input'),
label: "Error Message"|t('matchinput'),
instructions: "Error message when pattern does not match field"|t('matchinput'),
id: 'errorMessage',
name: 'errorMessage',
value: field.errorMessage,
Expand Down

0 comments on commit 5dc2e32

Please sign in to comment.