(Grav GitSync) Automatic Commit from RealStickman

This commit is contained in:
RealStickman 2022-05-18 09:46:26 +02:00 committed by GitSync
parent ab2a6f429c
commit db6e12032c
47 changed files with 11059 additions and 54 deletions

View File

@ -0,0 +1,17 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
# 4 space indentation
[*.php]
indent_size = 4

16
plugins/admin/.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
themes/grav/.sass-cache
.DS_Store
crowdin.yaml
# Node Modules
**/node_modules/**
themes/grav/js/admin.js
themes/grav/js/vendor.js
themes/grav/js/*.map
.idea
tests/_output/*
tests/_support/_generated/*
tests/cache/*
tests/error.log
/crowdin.yaml

View File

@ -1,3 +1,22 @@
# v1.10.33.1
## 04/25/2022
1. [](#bugfix)
* Reverted [PR#2265](https://github.com/getgrav/grav-plugin-admin/pull/2265) as it broke sections output.
# v1.10.33
## 04/25/2022
1. [](#new)
* Require **Form 6.0.1**
2. [](#improved)
* Added support for a single `field:` vs `fields:` in element form field to store a single value to the option field
* Allow new media collapser logic to configure different cookie storage name location via `data-storage-location`
1. [](#bugfix)
* Fixed nested element form fields
* Fixed `columns` and `column` fields with `.dotted` variables inside to ignore columns and column names
* Fixed initial elements state not being restored
# v1.10.32
## 03/28/2022

View File

@ -1,7 +1,7 @@
name: Admin Panel
slug: admin
type: plugin
version: 1.10.32
version: 1.10.33.1
description: Adds an advanced administration panel to manage your site
icon: empire
author:
@ -16,7 +16,7 @@ license: MIT
dependencies:
- { name: grav, version: '>=1.7.32' }
- { name: form, version: '>=6.0.0' }
- { name: form, version: '>=6.0.1' }
- { name: login, version: '>=3.7.0' }
- { name: email, version: '>=3.1.6' }
- { name: flex-objects, version: '>=1.2.0' }

15
plugins/admin/hebe.json Normal file
View File

@ -0,0 +1,15 @@
{
"project":"grav-plugin-admin",
"platforms":{
"grav":{
"nodes":{
"plugin":[
{
"source":"/",
"destination":"/user/plugins/admin"
}
]
}
}
}
}

View File

@ -191,6 +191,8 @@ PLUGIN_ADMIN:
FILE_COULD_NOT_BE_DELETED: "File could not be deleted"
FILE_NOT_FOUND: "File not found"
NO_FILE_FOUND: "No file found"
FIELD_REORDER_SUCCESSFUL: "Media Order updated for field '%s'"
FIELD_REORDER_FAILED: "An error occurred while storing the media order for the field '%s'"
GRAV_WAS_SUCCESSFULLY_UPDATED_TO: "Grav was successfully updated to"
GRAV_UPDATE_FAILED: "Grav update failed"
EVERYTHING_UPDATED: "Everything updated"

View File

@ -8,3 +8,5 @@ $(document).on('change', '[data-grav-elements] select', (event) => {
$(`[id^="${id}_"]`).css('display', 'none');
$(`[id="${id}__${value}"]`).css('display', 'inherit');
});
$('[data-grav-elements] select').trigger('change');

View File

View File

@ -140,7 +140,7 @@ export default class PageMedia extends FilesField {
if (status.width) {
const input = this.container.closest('.pagemedia-field').find('.media-resizer');
updateMediaSizes(input, status.width, false);
updateMediaSizes(input[0], status.width, false);
}
}
@ -231,21 +231,23 @@ export default class PageMedia extends FilesField {
}
export const updateMediaSizes = (input, width, store = true) => {
const status = JSON.parse(Cookies.get('grav-admin-pagemedia') || '{}');
const storageLocation = input.dataset.storageLocation || 'grav-admin-pagemedia';
const status = JSON.parse(Cookies.get(storageLocation) || '{}');
const height = 150 * width / 200;
const media = input.closest('.pagemedia-field').find('.dz-details, [data-dz-thumbnail]');
const media = $(input).closest('.pagemedia-field').find('.dz-details, [data-dz-thumbnail]');
media.css({ width, height });
if (store) {
const data = Object.assign({}, status, { width });
Cookies.set('grav-admin-pagemedia', JSON.stringify(data), { expires: Infinity });
Cookies.set(storageLocation, JSON.stringify(data), { expires: Infinity });
}
};
export const updateMediaCollapseStatus = (element, store = true) => {
const status = JSON.parse(Cookies.get('grav-admin-pagemedia') || '{}');
const storageLocation = element.dataset.storageLocation || 'grav-admin-pagemedia';
const status = JSON.parse(Cookies.get(storageLocation) || '{}');
element = $(element);
const icon = element.find('i.fa');
@ -262,7 +264,7 @@ export const updateMediaCollapseStatus = (element, store = true) => {
if (store) {
const data = Object.assign({}, status, { collapsed });
Cookies.set('grav-admin-pagemedia', JSON.stringify(data), { expires: Infinity });
Cookies.set(storageLocation, JSON.stringify(data), { expires: Infinity });
}
};
@ -270,7 +272,7 @@ $(document).on('input', '.media-resizer', (event) => {
const target = $(event.currentTarget);
const width = target.val();
updateMediaSizes(target, width);
updateMediaSizes(event.currentTarget, width);
});
$(document).on('click', '.media-collapser', (event) => {
@ -278,13 +280,14 @@ $(document).on('click', '.media-collapser', (event) => {
});
$(document).ready(() => {
const status = JSON.parse(Cookies.get('grav-admin-pagemedia') || '{}');
if (status.width) {
$('.media-resizer').each((index, input) => {
input = $(input);
$('.media-resizer').each((index, input) => {
const storageLocation = input.dataset.storageLocation || 'grav-admin-pagemedia';
const status = JSON.parse(Cookies.get(storageLocation) || '{}');
if (status.width) {
updateMediaSizes(input, status.width, false);
});
}
}
});
});
export let Instance = new PageMedia();

0
plugins/admin/themes/grav/css/chartist.min.css vendored Executable file → Normal file
View File

0
plugins/admin/themes/grav/css/fork-awesome.min.css vendored Executable file → Normal file
View File

0
plugins/admin/themes/grav/css/iconpicker.css Executable file → Normal file
View File

View File

View File

Before

Width:  |  Height:  |  Size: 463 KiB

After

Width:  |  Height:  |  Size: 463 KiB

View File

View File

View File

View File

@ -4404,7 +4404,7 @@ var PageMedia = /*#__PURE__*/function (_FilesField) {
if (status.width) {
var input = this.container.closest('.pagemedia-field').find('.media-resizer');
updateMediaSizes(input, status.width, false);
updateMediaSizes(input[0], status.width, false);
}
}
}, {
@ -4510,9 +4510,10 @@ var PageMedia = /*#__PURE__*/function (_FilesField) {
var updateMediaSizes = function updateMediaSizes(input, width) {
var store = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var status = JSON.parse(cookies.get('grav-admin-pagemedia') || '{}');
var storageLocation = input.dataset.storageLocation || 'grav-admin-pagemedia';
var status = JSON.parse(cookies.get(storageLocation) || '{}');
var height = 150 * width / 200;
var media = input.closest('.pagemedia-field').find('.dz-details, [data-dz-thumbnail]');
var media = external_jQuery_default()(input).closest('.pagemedia-field').find('.dz-details, [data-dz-thumbnail]');
media.css({
width: width,
height: height
@ -4522,14 +4523,15 @@ var updateMediaSizes = function updateMediaSizes(input, width) {
var data = Object.assign({}, status, {
width: width
});
cookies.set('grav-admin-pagemedia', JSON.stringify(data), {
cookies.set(storageLocation, JSON.stringify(data), {
expires: Infinity
});
}
};
var updateMediaCollapseStatus = function updateMediaCollapseStatus(element) {
var store = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var status = JSON.parse(cookies.get('grav-admin-pagemedia') || '{}');
var storageLocation = element.dataset.storageLocation || 'grav-admin-pagemedia';
var status = JSON.parse(cookies.get(storageLocation) || '{}');
element = external_jQuery_default()(element);
var icon = element.find('i.fa');
var container = element.closest('.pagemedia-field');
@ -4545,7 +4547,7 @@ var updateMediaCollapseStatus = function updateMediaCollapseStatus(element) {
var data = Object.assign({}, status, {
collapsed: collapsed
});
cookies.set('grav-admin-pagemedia', JSON.stringify(data), {
cookies.set(storageLocation, JSON.stringify(data), {
expires: Infinity
});
}
@ -4553,20 +4555,20 @@ var updateMediaCollapseStatus = function updateMediaCollapseStatus(element) {
external_jQuery_default()(document).on('input', '.media-resizer', function (event) {
var target = external_jQuery_default()(event.currentTarget);
var width = target.val();
updateMediaSizes(target, width);
updateMediaSizes(event.currentTarget, width);
});
external_jQuery_default()(document).on('click', '.media-collapser', function (event) {
updateMediaCollapseStatus(event.currentTarget);
});
external_jQuery_default()(document).ready(function () {
var status = JSON.parse(cookies.get('grav-admin-pagemedia') || '{}');
external_jQuery_default()('.media-resizer').each(function (index, input) {
var storageLocation = input.dataset.storageLocation || 'grav-admin-pagemedia';
var status = JSON.parse(cookies.get(storageLocation) || '{}');
if (status.width) {
external_jQuery_default()('.media-resizer').each(function (index, input) {
input = external_jQuery_default()(input);
if (status.width) {
updateMediaSizes(input, status.width, false);
});
}
}
});
});
var media_Instance = new PageMedia();
;// CONCATENATED MODULE: ./app/pages/page/multilang.js
@ -9695,6 +9697,7 @@ external_jQuery_default()(document).on('change', '[data-grav-elements] select',
external_jQuery_default()("[id^=\"".concat(id, "_\"]")).css('display', 'none');
external_jQuery_default()("[id=\"".concat(id, "__").concat(value, "\"]")).css('display', 'inherit');
});
external_jQuery_default()('[data-grav-elements] select').trigger('change');
;// CONCATENATED MODULE: ./app/forms/fields/index.js
@ -15265,4 +15268,4 @@ module.exports = jQuery;
/******/ Grav = __webpack_exports__;
/******/
/******/ })()
;
;

View File

@ -4599,7 +4599,7 @@ return Chartist;
// If we're not in Markdown mode, fall back to normal newlineAndIndent
var eolState = cm.getStateAfter(pos.line);
var inner = CodeMirror.innerMode(cm.getMode(), eolState);
if (inner.mode.name !== "markdown") {
if (inner.mode.name !== "markdown" && inner.mode.helperType !== "markdown") {
cm.execCommand("newlineAndIndent");
return;
} else {
@ -15331,7 +15331,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
addLegacyProps(CodeMirror);
CodeMirror.version = "5.65.1";
CodeMirror.version = "5.65.2";
return CodeMirror;
@ -15840,6 +15840,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
stream.eatWhile(/[\w\$_]/);
return "meta";
},
'"': function(stream, state) {
if (!stream.match('""\n')) return false;
state.tokenize = tokenTripleString;
return state.tokenize(stream, state);
}
},
modeProps: {fold: ["brace", "import"]}
@ -17334,7 +17339,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
}
function getTagRegexp(tagName, anchored) {
return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i");
return new RegExp((anchored ? "^" : "") + "<\/\\s*" + tagName + "\\s*>", "i");
}
function addTags(from, to) {

View File

@ -1,7 +1,7 @@
{% extends "forms/field.html.twig" %}
{% block field %}
{% embed 'forms/default/fields.html.twig' with {name: field.name, fields: field.fields} %}
{% embed 'forms/default/fields.html.twig' with {name: name, fields: field.fields} %}
{% block outer_markup_field_open %}<div class="form-column block pure-u-1-{{ cols }}">{% endblock %}
{% block outer_markup_field_close %}</div>{% endblock %}
{% endembed %}

View File

@ -3,6 +3,6 @@
{% block field %}
<div class="form-columns grid pure-g">
{% set cols = field.fields|length %}
{% include 'forms/default/fields.html.twig' with {name: field.name, fields: field.fields, fallback_field: 'column', cols: cols} %}
{% include 'forms/default/fields.html.twig' with {name: field.name|parent_field, fields: field.fields, fallback_field: 'column', cols: cols} %}
</div>
{% endblock %}

View File

@ -1,12 +1,19 @@
{% extends "forms/field.html.twig" %}
{% block field %}
{% set name = parent_name|parent_field ~ '.' ~ field.name %}
{% set fields = prepare_form_fields(field.fields, name) %}
{% set parent = parent_name|parent_field %}
{% set plain_name = (field.plain_name ?? field.name)|string %}
{% set name = parent ~ '.' ~ plain_name %}
{% if field.field %}
{% set fields = prepare_form_fields({(name): field.field}) %}
{% else %}
{% set fields = prepare_form_fields(field.fields, name) %}
{% endif %}
{% embed 'forms/default/fields.html.twig' with {name: name, fields: fields} %}
{% set initial_state = field.name|string is not same as (parent_value|string) ? 'display: none;' %}
{% set initial_state = plain_name is not same as (parent_value|string) ? 'display: none;' %}
{% block outer_markup_field_open %}
<div id="{{ parent_name ~ '__' ~ field.name|string }}" class="form-element" style="{{ initial_state }}">
<div id="{{ parent_name ~ '__' ~ plain_name }}" class="form-element" style="{{ initial_state }}">
{% endblock %}
{% block outer_markup_field_close %}

View File

0
plugins/admin/themes/grav/watch.sh Executable file → Normal file
View File

File diff suppressed because it is too large Load Diff

0
plugins/admin/vendor/bin/picofeed vendored Executable file → Normal file
View File

0
plugins/admin/vendor/bin/pscss vendored Executable file → Normal file
View File

View File

@ -0,0 +1,22 @@
name: Autocloser
on: [issues, pull_request]
jobs:
autoclose:
runs-on: ubuntu-latest
steps:
- name: Autoclose new issues and PRs
uses: roots/issue-closer@v1.1
with:
repo-token: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
issue-pattern: "^exact-string-will-never-match$"
pr-pattern: "^exact-string-will-never-match$"
issue-close-message: |
This package is considered feature-complete, and is now in **security-only** maintenance mode, following a [decision by the Technical Steering Committee](https://github.com/laminas/technical-steering-committee/blob/2b55453e172a1b8c9c4c212be7cf7e7a58b9352c/meetings/minutes/2020-08-03-TSC-Minutes.md#vote-on-components-to-mark-as-security-only).
If you have a security issue, please [follow our security reporting guidelines](https://getlaminas.org/security/).
If you wish to take on the role of maintainer, please [nominate yourself](https://github.com/laminas/technical-steering-committee/issues/new?assignees=&labels=Nomination&template=Maintainer_Nomination.md&title=%5BNOMINATION%5D%5BMAINTAINER%5D%3A+%7Bname+of+person+being+nominated%7D)
pr-close-message: |
This package is considered feature-complete, and is now in **security-only** maintenance mode, following a [decision by the Technical Steering Committee](https://github.com/laminas/technical-steering-committee/blob/2b55453e172a1b8c9c4c212be7cf7e7a58b9352c/meetings/minutes/2020-08-03-TSC-Minutes.md#vote-on-components-to-mark-as-security-only).
If you have a security issue, please [follow our security reporting guidelines](https://getlaminas.org/security/).
If you wish to take on the role of maintainer, please [nominate yourself](https://github.com/laminas/technical-steering-committee/issues/new?assignees=&labels=Nomination&template=Maintainer_Nomination.md&title=%5BNOMINATION%5D%5BMAINTAINER%5D%3A+%7Bname+of+person+being+nominated%7D)

View File

@ -0,0 +1,33 @@
name: "Continuous Integration"
on:
pull_request:
push:
branches:
- '[0-9]+.[0-9]+.x'
- 'refs/pull/*'
tags:
jobs:
matrix:
name: Generate job matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Gather CI configuration
id: matrix
uses: laminas/laminas-ci-matrix-action@v1
qa:
name: QA Checks
needs: [matrix]
runs-on: ${{ matrix.operatingSystem }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
steps:
- name: ${{ matrix.name }}
uses: laminas/laminas-continuous-integration-action@v1
with:
job: ${{ matrix.job }}

View File

@ -0,0 +1,71 @@
# Alternate workflow example.
# This one is identical to the one in release-on-milestone.yml, with one change:
# the Release step uses the ORGANIZATION_ADMIN_TOKEN instead, to allow it to
# trigger a release workflow event. This is useful if you have other actions
# that intercept that event.
name: "Automatic Releases"
on:
milestone:
types:
- "closed"
jobs:
release:
name: "GIT tag, release & create merge-up PR"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Release"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:release"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create Merge-Up Pull Request"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-merge-up-pull-request"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create and/or Switch to new Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Bump Changelog Version On Originating Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:bump-changelog"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create new milestones"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-milestones"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

View File

@ -0,0 +1,32 @@
name: "Continuous Integration"
on:
pull_request:
push:
branches:
- '[0-9]+.[0-9]+.x'
- 'refs/pull/*'
jobs:
matrix:
name: Generate job matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Gather CI configuration
id: matrix
uses: laminas/laminas-ci-matrix-action@v1
qa:
name: QA Checks
needs: [matrix]
runs-on: ${{ matrix.operatingSystem }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
steps:
- name: ${{ matrix.name }}
uses: laminas/laminas-continuous-integration-action@v1
with:
job: ${{ matrix.job }}

View File

@ -0,0 +1,61 @@
# Alternate workflow example.
# This one is identical to the one in release-on-milestone.yml, with one change:
# the Release step uses the ORGANIZATION_ADMIN_TOKEN instead, to allow it to
# trigger a release workflow event. This is useful if you have other actions
# that intercept that event.
name: "Automatic Releases"
on:
milestone:
types:
- "closed"
jobs:
release:
name: "GIT tag, release & create merge-up PR"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Release"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:release"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create Merge-Up Pull Request"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-merge-up-pull-request"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create and/or Switch to new Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create new milestones"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-milestones"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

0
plugins/admin/vendor/p3k/picofeed/picofeed vendored Executable file → Normal file
View File

0
plugins/admin/vendor/scssphp/scssphp/bin/pscss vendored Executable file → Normal file
View File

5
plugins/form/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# OS Generated
.DS_Store*
/.idea
node_modules
*.js.map

View File

@ -1,3 +1,24 @@
# v6.0.3
## 05/05/2022
1. [](#bugfix)
* Regression: Fixed broken `addForm()` method
# v6.0.2
## 05/02/2022
1. [](#bugfix)
* Fixed `forms({ route: '/forms/_myform' })` not finding form from non-routable pages (second try)
# v6.0.1
## 04/25/2022
1. [](#improved)
* Improved `prepare_form_field()` twig method to include `plain_name`
1. [](#bugfix)
* Fixed `columns` and `column` fields with `.dotted` variables inside to ignore columns and column names
* Fixed `forms({ route: '/forms/_myform' })` not finding forms from non-routable pages
# v6.0.0
## 03/28/2022

0
plugins/form/assets/signature_pad.js Executable file → Normal file
View File

View File

@ -1,7 +1,7 @@
name: Form
slug: form
type: plugin
version: 6.0.0
version: 6.0.3
description: Enables the forms handling
icon: check-square
author:

View File

@ -90,21 +90,28 @@ class TwigExtension extends AbstractExtension
return null;
}
// If field has already been prepared, we do not need to do anything.
if (!empty($field['prepared'])) {
return $field;
}
// Check if we have just a list of fields (no name given).
if (is_int($name)) {
$fieldName = (string)($field['name'] ?? $name);
if (!is_string($name) || $name === '') {
// Look at the field.name and if not set, fall back to the key.
$name = (string)($field['name'] ?? $name);
$name = $fieldName;
}
// Make sure that the field has a name.
$name = $name ?? $field['name'] ?? null;
if (!is_string($name) || $name === '') {
if ($name === '') {
return null;
}
// Prefix name with the parent name if needed.
if (str_starts_with($name, '.')) {
$name = $parent ? $parent . $name : (string)substr($name, 1);
$plainName = (string)substr($name, 1);
$field['plain_name'] = $plainName;
$name = $parent ? $parent . $name : $plainName;
} elseif (isset($options['key'])) {
$name = str_replace('*', $options['key'], $name);
}
@ -125,6 +132,7 @@ class TwigExtension extends AbstractExtension
// Always set field name.
$field['name'] = $name;
$field['prepared'] = true;
return $field;
}

View File

@ -780,13 +780,11 @@ class FormPlugin extends Plugin
*/
public function addFormDefinition(PageInterface $page, string $name, array $form): void
{
if (!$page->routable()) {
return;
}
$route = $page->home() ? '/' : $page->route();
if (!isset($this->forms[$route][$name])) {
$form['_page_routable'] = !$page->isModule();
$this->forms[$route][$name] = $form;
$this->recache_forms = true;
}
@ -808,6 +806,8 @@ class FormPlugin extends Plugin
$name = $form->getName();
if (!isset($this->forms[$route][$name])) {
$form['_page_routable'] = true;
$this->forms[$route][$name] = $form;
$this->recache_forms = true;
}
@ -850,7 +850,7 @@ class FormPlugin extends Plugin
// Use fixed route for the form.
$route_provided = true;
$page = $pages->find($route);
$page = $pages->find($route, true);
} else {
// Search form from the current page first.
$route_provided = false;
@ -1052,7 +1052,7 @@ class FormPlugin extends Plugin
$list = [];
foreach ($this->forms as $route => $forms) {
foreach ($forms as $key => $form) {
if ($name === $key) {
if ($name === $key && !empty($form['_page_routable'])) {
$list[] = [$route, $key, $form];
}
}

15
plugins/form/hebe.json Normal file
View File

@ -0,0 +1,15 @@
{
"project":"grav-plugin-form",
"platforms":{
"grav":{
"nodes":{
"plugin":[
{
"source":"/",
"destination":"/user/plugins/form"
}
]
}
}
}
}

View File

@ -1,7 +1,7 @@
{% extends "forms/field.html.twig" %}
{% block field %}
{% embed 'forms/default/fields.html.twig' with {name: field.name, fields: field.fields} %}
{% embed 'forms/default/fields.html.twig' with {name: name, fields: field.fields} %}
{% block outer_markup_field_open %}<div class="form-column {{ field.classes }}">{% endblock %}
{% block outer_markup_field_close %}</div>{% endblock %}
{% endembed %}

View File

@ -2,6 +2,6 @@
{% block field %}
<div class="form-columns {{ field.classes }}">
{% include 'forms/default/fields.html.twig' with {name: field.name, fields: field.fields} %}
{% include 'forms/default/fields.html.twig' with {name: field.name|parent_field, fields: field.fields} %}
</div>
{% endblock %}

View File

@ -5,7 +5,7 @@
'type' => 'grav-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '97a332c933d346ae767003023580484cd9d64965',
'reference' => '2e6d16dbc801d605f56d2d2942cd99a8bf63550c',
'name' => 'getgrav/grav-plugin-form',
'dev' => true,
),
@ -16,7 +16,7 @@
'type' => 'grav-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '97a332c933d346ae767003023580484cd9d64965',
'reference' => '2e6d16dbc801d605f56d2d2942cd99a8bf63550c',
'dev_requirement' => false,
),
'google/recaptcha' => array(

View File

@ -0,0 +1,7 @@
/.php_cs.cache
/.phpunit.result.cache
/build
/composer.lock
/examples/config.php
/nbproject/private/
/vendor/

View File

@ -0,0 +1,33 @@
dist: trusty
language: php
sudo: false
php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
before_script:
- composer install
- phpenv version-name | grep ^5.[34] && echo "extension=apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; true
- phpenv version-name | grep ^5.[34] && echo "apc.enable_cli=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; true
script:
- mkdir -p build/logs
- composer run-script lint
- composer run-script test
after_success:
- travis_retry php vendor/bin/php-coveralls
cache:
directories:
- "$HOME/.composer/cache/files"
git:
depth: 5

7407
plugins/form/yarn.lock Normal file

File diff suppressed because it is too large Load Diff