Skip to content

Commit e328ed3

Browse files
committed
chore: Refactor and update
1 parent 812dbf5 commit e328ed3

19 files changed

+4115
-188
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Force LF
2+
* text eol=lf

.github/ISSUE_TEMPLATE/Bug_Report.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug Report
3+
about: Create a bug report
4+
labels: bug
5+
---
6+
7+
STOP! Your bug may have already been reported. Please search on the [issue tracker](https://github.com/pointybeard/symext-field-unique-input/issues) before creating a new one.
8+
9+
## Expected Behavior
10+
11+
[ Describe what you think SHOULD happen ]
12+
13+
## Actual Behavior
14+
15+
[ Describe what actually DID happen ]
16+
17+
## Steps to Reproduce the Problem
18+
19+
1.
20+
2.
21+
3.
22+
23+
## Your Environment
24+
25+
<!--- Include as many relevant details about the environment you experienced the bug in -->
26+
27+
* Version used:
28+
* Browser Name and Version:
29+
* Operating System and Version (desktop or mobile):
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: "Feature Request"
3+
about: "I have a suggestion!"
4+
labels: "enhancement"
5+
---
6+
7+
STOP! Your feature request may have already been requested. Please search on the [issue tracker](https://github.com/pointybeard/symext-field-unique-input/issues) before creating a new one.
8+
9+
## Feature Request
10+
11+
**Is your feature request related to a problem?**
12+
Description of what the problem is. E.g., I have an issue when [...]
13+
14+
**Describe the solution you would like**
15+
A description of what you want to happen.
16+
17+
**Describe alternatives you have considered**
18+
Alternative solutions or features you've considered.

.github/ISSUE_TEMPLATE/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false

.github/SECURITY.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Reporting a vulnerability
2+
3+
If you have found any issues that might have security implications, please send a report privately to [email protected]
4+
5+
Do not report security reports publicly.

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor/
2+
.DS_Store
3+
.php_cs.cache
4+
/commands

.php-commitizen.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
return [
6+
'type' => [
7+
'lengthMin' => 3,
8+
'lengthMax' => 8,
9+
'acceptExtra' => false,
10+
'values' => [
11+
'feat',
12+
'fix',
13+
'docs',
14+
'chore',
15+
'test',
16+
'refactor',
17+
'revert',
18+
'ci',
19+
]
20+
],
21+
'scope' => [
22+
'lengthMin' => 0,
23+
'lengthMax' => 10,
24+
'acceptExtra' => true,
25+
'values' => [],
26+
],
27+
'description' => [
28+
'lengthMin' => 1,
29+
'lengthMax' => 47,
30+
],
31+
'subject' => [
32+
'lengthMin' => 1,
33+
'lengthMax' => 69,
34+
],
35+
'body' => [
36+
'wrap' => 72,
37+
],
38+
'footer' => [
39+
'wrap' => 72,
40+
],
41+
];

.php_cs.dist

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$header = <<<EOF
6+
This file is part of the "Unique Text Input Field for Symphony CMS" repository.
7+
8+
Copyright 2020 Alannah Kearney <[email protected]>
9+
10+
For the full copyright and license information, please view the LICENCE
11+
file that was distributed with this source code.
12+
EOF;
13+
14+
$finder = PhpCsFixer\Finder::create()
15+
->files()
16+
->name('*.php')
17+
->in(__DIR__)
18+
->in(__DIR__.'/src/Includes')
19+
->exclude(__DIR__.'/vendor')
20+
;
21+
22+
return PhpCsFixer\Config::create()
23+
->setUsingCache(true)
24+
->setRiskyAllowed(true)
25+
->setRules(array(
26+
'@PSR2' => true,
27+
'@Symfony' => true,
28+
'is_null' => true,
29+
'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'return', 'throw', 'try']],
30+
'cast_spaces' => ['space' => 'single'],
31+
'header_comment' => ['header' => $header],
32+
'include' => true,
33+
'class_attributes_separation' => ['elements' => ['method']],
34+
'no_blank_lines_after_class_opening' => true,
35+
'no_blank_lines_after_phpdoc' => true,
36+
'no_empty_statement' => true,
37+
'no_extra_consecutive_blank_lines' => true,
38+
'no_leading_import_slash' => true,
39+
'no_leading_namespace_whitespace' => true,
40+
'no_trailing_comma_in_singleline_array' => true,
41+
'no_unused_imports' => true,
42+
'no_whitespace_in_blank_line' => true,
43+
'object_operator_without_whitespace' => true,
44+
'phpdoc_align' => true,
45+
'phpdoc_indent' => true,
46+
'phpdoc_no_access' => true,
47+
'phpdoc_no_package' => true,
48+
'phpdoc_order' => true,
49+
'phpdoc_scalar' => true,
50+
'phpdoc_trim' => true,
51+
'phpdoc_types' => true,
52+
'psr0' => true,
53+
'array_syntax' => ['syntax' => 'short'],
54+
'declare_strict_types' => true,
55+
'single_blank_line_before_namespace' => true,
56+
'standardize_not_equals' => true,
57+
'ternary_operator_spaces' => true,
58+
'trailing_comma_in_multiline_array' => true,
59+
))
60+
->setFinder($finder)
61+
;

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
This project adheres to [Semantic Versioning](http://semver.org/).
4+
5+
## [1.6.0][] - 2020-12-27
6+
#### Changed
7+
- Refactoring of folder structure
8+
- Using Symphony Extended library
9+
10+
[1.6.0]: https://github.com/pointybeard/symext-field-unique-input/compare/1.6.0...1.5.4

CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing to this project
2+
3+
We encourage contribution to this project and only ask you follow some simple rules to make everyone's job a little easier.
4+
5+
## Found a bug?
6+
7+
Please lodge an issue at the GitHub issue tracker for this project -- [https://github.com/pointybeard/symext-field-unique-input/issues](https://github.com/pointybeard/symext-field-unique-input/issues)
8+
9+
Include details on the behaviour you are seeing, and steps needed to reproduce the problem.
10+
11+
## Want to contribute code?
12+
13+
* Fork the project
14+
* Make your feature addition or bug fix
15+
* Ensure your code is nicely formatted
16+
* Commit just the modifications, do not alter CHANGELOG.md. If relevant, link to GitHub issue (see [https://help.github.com/articles/closing-issues-via-commit-messages/](https://help.github.com/articles/closing-issues-via-commit-messages/))
17+
* Send the pull request
18+
19+
We will review the code and either merge it in, or leave some feedback.

LICENCE.txt LICENCE

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
All source code included in the "Field: Unique Text Input" Symphony Extension archive
1+
All source code included in the "Unique Text Input Field for Symphony CMS" Symphony Extension archive
22
is, unless otherwise specified, released under the MIT licence as follows:
33

44
----- begin license block -----
55

6-
Copyright 2008-2011 Alistair Kearney, Allen Chang, Scott Hughes, Airlock (http://airlock.com)
6+
Copyright 2008-2011 Alannah Kearney, Allen Chang, Scott Hughes, Airlock (http://airlock.com)
77
Copyright 2016-2018 Symphony CMS Community (https://github.com/symphonycms/uniqueinputfield/graphs/contributors)
8+
Copyright 2020 Alannah Kearney
89

910
Permission is hereby granted, free of charge, to any person obtaining a copy
1011
of this software and associated documentation files (the "Software"), to deal
@@ -24,4 +25,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2425
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2526
THE SOFTWARE.
2627

27-
----- end license block -----
28+
----- end license block -----

README.md

+82-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,93 @@
1-
# Field: Unique Text Input
1+
# Unique Text Input Field for Symphony CMS
22

3-
Makes the value's handle unique across the section
3+
A field for [Symphony CMS][ext-symphony-cms] that enforces uniqueness
4+
5+
- [Installation](#installation)
6+
- [Requirements](#dependencies)
7+
- [Dependencies](#dependencies)
8+
- [Basic Usage](#basic-usage)
9+
- [Support](#support)
10+
- [Contributing](#contributing)
11+
- [License](#license)
412

513
## Installation
614

7-
1. Upload the `/uniqueinputfield` folder to your Symphony `/extensions` folder.
15+
Clone the latest version to your `/extensions` folder and run composer to install required packaged with
16+
17+
### Manually (git + composer)
18+
```bash
19+
$ git clone https://github.com/pointybeard/symext-field-unique-input.git field_uniquetextinput
20+
$ composer update -vv --profile -d ./field_uniquetextinput
21+
```
22+
After finishing the steps above, enable "Section Model Builder" though the administration interface or, if using [Orchestra][ext-orchestra], with `bin/extension enable field_uniquetextinput`.
23+
24+
### With Orchestra
25+
26+
1. Add the following extension defintion to your `.orchestra/build.json` file in the `"extensions"` block:
27+
28+
```json
29+
{
30+
"name": "field_uniquetextinput",
31+
"repository": {
32+
"url": "https://github.com/pointybeard/symext-field-unique-input.git"
33+
}
34+
}
35+
```
36+
37+
2. Run the following command to rebuild your Extensions
38+
39+
```bash
40+
$ bin/orchestra build \
41+
--skip-import-sections \
42+
--database-skip-import-data \
43+
--database-skip-import-structure \
44+
--skip-create-author \
45+
--skip-seeders \
46+
--skip-git-reset \
47+
--skip-composer \
48+
--skip-postbuild
49+
```
50+
51+
# Requirements
52+
53+
- This extension works with PHP 7.4 or above.
854

9-
2. Enable it by selecting the "Field: Unique Text Input", choose Enable from the with-selected menu, then click Apply.
55+
# Dependencies
1056

11-
3. You can now add the "Unique Text Input" field to your sections.
57+
This extension depends on the following Composer libraries:
1258

59+
- [PHP Helpers][dep-helpers]
60+
- [Symphony CMS: Extended Base Class Library][dep-symphony-extended]
1361

1462
## Usage
1563

16-
- Behaves identically to a normal text input, however it enforces uniqueness of the handle and you cannot group the output in Data Sources.
64+
Enable this field via the interface and add it to your sections like any other field.
65+
66+
This field behaves identically to a standard text input field, however, it enforces uniqueness of the handle. Note, output in Data Sources cannot be grouped by a Unique Text Input field.
67+
68+
There are two (2) modes which allow the choice between throwing an error, e.g. "This must be unique", or maintain uniqueness by automatically by appending a number to the handle value, eg. `my-entry-handle-2`.
69+
70+
## Support
71+
72+
If you believe you have found a bug, please report it using the [GitHub issue tracker][ext-issues],
73+
or better yet, fork the library and submit a pull request.
74+
75+
## Contributing
76+
77+
We encourage you to contribute to this project. Please check out the [Contributing to this project][doc-contributing] documentation for guidelines about how to get involved.
78+
79+
## Author
80+
- Alannah Kearney - http://github.com/pointybeard
81+
- See also the list of [contributors][ext-contributor] who participated in this project
82+
83+
## License
84+
"Unique Text Input Field for Symphony CMS" is released under the MIT License. See [LICENCE][doc-licence] for details.
1785

18-
- Two modes allow you to choose between throwing an error, "This must be unique", or attempting to make the handle unique automatically by appending an number, eg. `my-entry-handle-2`
86+
[doc-contributing]: https://github.com/pointybeard/symext-field-unique-input/blob/master/CONTRIBUTING.md
87+
[doc-licence]: http://www.opensource.org/licenses/MIT
88+
[dep-helpers]: https://github.com/pointybeard/helpers
89+
[dep-symphony-extended]: https://github.com/pointybeard/symphony-extended
90+
[ext-issues]: https://github.com/pointybeard/symext-field-unique-input/issues
91+
[ext-symphony-cms]: http://getsymphony.com
92+
[ext-orchestra]: https://github.com/pointybeard/orchestra
93+
[ext-contributor]: https://github.com/pointybeard/symext-field-unique-input/contributors

composer.json

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "pointybeard/symext-field-unique-input",
3+
"description": "A field for Symphony CMS that enforces uniqueness",
4+
"homepage": "https://github.com/pointybeard/symext-field-unique-input",
5+
"license": "MIT",
6+
"minimum-stability": "stable",
7+
"keywords": [
8+
"php",
9+
"field",
10+
"symphony",
11+
"symphonycms",
12+
"symphony field",
13+
"symphony extension",
14+
"symphonycms field",
15+
"symphonycms extension"
16+
],
17+
"type": "library",
18+
"authors": [
19+
{
20+
"name": "Alannah Kearney",
21+
"email": "[email protected]",
22+
"homepage": "http://alannahkearney.com",
23+
"role": "Developer"
24+
}
25+
],
26+
"support": {
27+
"issues": "https://github.com/pointybeard/symext-field-unique-input/issues"
28+
},
29+
"require": {
30+
"php": ">=7.4",
31+
"pointybeard/helpers": "^1.2.0",
32+
"pointybeard/symphony-extended": "^1.0"
33+
},
34+
"require-dev": {
35+
"squizlabs/php_codesniffer": "3.*",
36+
"friendsofphp/php-cs-fixer": "^2.16",
37+
"damianopetrungaro/php-commitizen": "^0.1.2",
38+
"php-parallel-lint/php-parallel-lint": "^1.2"
39+
},
40+
"autoload": {
41+
"psr-4": {
42+
"pointybeard\\Symphony\\Extensions\\": "src/"
43+
}
44+
},
45+
"scripts": {
46+
"post-update-cmd": "mkdir -p fields",
47+
"tidy": "php-cs-fixer fix --config=.php_cs.dist -v --using-cache=no",
48+
"tidyDry": "@tidy --dry-run",
49+
"test": [
50+
"parallel-lint . --exclude vendor"
51+
],
52+
"clean": "rm -rf fields"
53+
},
54+
"config": {
55+
"sort-packages": true,
56+
"process-timeout": 0
57+
}
58+
}

0 commit comments

Comments
 (0)