Skip to content

Commit 548c715

Browse files
committed
Initial commit
0 parents  commit 548c715

File tree

13 files changed

+435
-0
lines changed

13 files changed

+435
-0
lines changed

.circleci/config.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: 2.1
2+
3+
orbs:
4+
default:
5+
executors:
6+
php-73:
7+
docker:
8+
- image: 'circleci/php:7.3-stretch'
9+
jobs:
10+
build-php:
11+
executor: php-73
12+
steps:
13+
- run: php -v
14+
- checkout
15+
- restore_cache:
16+
keys:
17+
- composer-v1-{{ checksum "composer.lock" }}
18+
- composer-v1-
19+
- run: composer install -n --prefer-dist --no-scripts --no-suggest
20+
- run: composer lint
21+
- save_cache:
22+
key: composer-v1-{{ checksum "composer.lock" }}
23+
paths:
24+
- vendor
25+
26+
workflows:
27+
build:
28+
jobs:
29+
- default/build-php

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 2
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.php]
15+
indent_size = 4
16+
17+
[*.blade.php]
18+
indent_size = 2

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.gitattributes export-ignore
2+
/.github export-ignore
3+
/.circleci export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: Log1x

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Brandon Nifong
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Sage HTML Forms
2+
3+
![Latest Stable Version](https://img.shields.io/packagist/v/log1x/sage-html-forms?style=flat-square)
4+
![Build Status](https://img.shields.io/circleci/build/github/Log1x/sage-html-forms?style=flat-square)
5+
![Total Downloads](https://img.shields.io/packagist/dt/log1x/sage-html-forms?style=flat-square)
6+
7+
This is a simple package for [HTML Forms](https://github.com/ibericode/html-forms) that allows you to easily render forms using a corresponding Blade view (if one is present) with Sage 10.
8+
9+
A few additional opinionated tweaks include:
10+
11+
- Moving the HTML Forms admin menu item to the Options submenu.
12+
- Hide the ads shown in the sidebar of the admin page.
13+
14+
## Requirements
15+
16+
- [Sage](https://github.com/roots/sage) >= 10.0
17+
- [PHP](https://secure.php.net/manual/en/install.php) >= 7.2
18+
- [Composer](https://getcomposer.org/download/)
19+
20+
## Installation
21+
22+
Install via Composer:
23+
24+
```bash
25+
$ composer require log1x/sage-html-forms
26+
```
27+
28+
## Usage
29+
30+
### Getting Started
31+
32+
Start by creating a form in the HTML Forms admin menu page if you do not already have one.
33+
34+
You can leave the "Form code" blank as it will not be used if a corresponding Blade view exists.
35+
36+
### Creating a View
37+
38+
Once your form is created, create a Blade view in `views/forms/contact-us.blade.php` where `contact-us` is equal to your form's slug.
39+
40+
```php
41+
<x-html-forms :form="$form" class="my-form">
42+
<input
43+
name="name"
44+
type="text"
45+
placeholder="Full Name"
46+
required
47+
>
48+
49+
<input
50+
name="cool_email"
51+
type="email"
52+
placeholder="Email Address"
53+
required
54+
>
55+
56+
<input
57+
type="submit"
58+
value="Submit"
59+
/>
60+
</x-html-forms>
61+
```
62+
63+
...and you're done. Form action variables simply reference the input `name` so `[NAME]` and `[COOL_EMAIL]` will now be readily available.
64+
65+
## Bug Reports
66+
67+
If you discover a bug in Sage HTML Forms, please [open an issue](https://github.com/log1x/sage-html-forms/issues).
68+
69+
## Contributing
70+
71+
Contributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.
72+
73+
## License
74+
75+
Sage HTML Forms is provided under the [MIT License](https://github.com/log1x/sage-html-forms/blob/master/LICENSE.md).

composer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "log1x/sage-html-forms",
3+
"type": "package",
4+
"license": "MIT",
5+
"description": "Create forms using HTMLForms.io and Sage 10 Blade components",
6+
"authors": [
7+
{
8+
"name": "Brandon Nifong",
9+
"email": "brandon@tendency.me"
10+
}
11+
],
12+
"keywords": [
13+
"wordpress",
14+
"sage",
15+
"roots",
16+
"htmlforms"
17+
],
18+
"support": {
19+
"issues": "https://github.com/log1x/sage-html-forms/issues"
20+
},
21+
"autoload": {
22+
"psr-4": {
23+
"Log1x\\HtmlForms\\": "src/"
24+
}
25+
},
26+
"require": {
27+
"php": ">=7.2"
28+
},
29+
"require-dev": {
30+
"squizlabs/php_codesniffer": "^3.4"
31+
},
32+
"extra": {
33+
"acorn": {
34+
"providers": [
35+
"Log1x\\HtmlForms\\HtmlFormsServiceProvider"
36+
]
37+
}
38+
},
39+
"scripts": {
40+
"lint": [
41+
"phpcs --ignore=vendor,resources --extensions=php --standard=PSR12 ."
42+
]
43+
}
44+
}

composer.lock

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<form {!! $attributes->merge($form->attributes) !!}>
2+
<div style="display: none;">
3+
<input type="hidden" name="_hf_form_id" value="{{ $form->ID }}" />
4+
<input type="text" name="_hf_h{{ $form->ID }}" value="" />
5+
{!! $hiddenFields !!}
6+
</div>
7+
8+
{!! $slot !!}
9+
</form>

0 commit comments

Comments
 (0)