(Grav GitSync) Automatic Commit from smokephil
This commit is contained in:
parent
aa7c652b62
commit
a0f654c4c7
113 changed files with 3204 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
# v0.1.0
|
||||
## {{ "now"|date("m/d/Y") }}
|
||||
|
||||
1. [](#new)
|
||||
* ChangeLog started...
|
||||
21
plugins/devtools/components/plugin/flex/LICENSE.twig
Normal file
21
plugins/devtools/components/plugin/flex/LICENSE.twig
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
59
plugins/devtools/components/plugin/flex/README.md.twig
Normal file
59
plugins/devtools/components/plugin/flex/README.md.twig
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{% set component_title = (component.name|titleize) %}
|
||||
{% set component_hyphenated = (component.name|hyphenize) %}
|
||||
{% set developer_hyphenated = (component.author.githubid|hyphenize) %}
|
||||
# {{ component_title }} Plugin
|
||||
|
||||
**This README.md file should be modified to describe the features, installation, configuration, and general usage of the plugin.**
|
||||
|
||||
The **{{ component_title }}** Plugin is an extension for [Grav CMS](https://github.com/getgrav/grav). {{ component.description }}
|
||||
|
||||
## Installation
|
||||
|
||||
Installing the {{ component_title }} plugin can be done in one of three ways: The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command, the manual method lets you do so via a zip file, and the admin method lets you do so via the Admin Plugin.
|
||||
|
||||
### GPM Installation (Preferred)
|
||||
|
||||
To install the plugin via the [GPM](https://learn.getgrav.org/cli-console/grav-cli-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:
|
||||
|
||||
bin/gpm install {{ component_hyphenated }}
|
||||
|
||||
This will install the {{ component_title }} plugin into your `/user/plugins`-directory within Grav. Its files can be found under `/your/site/grav/user/plugins/{{ component_hyphenated }}`.
|
||||
|
||||
### Manual Installation
|
||||
|
||||
To install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `{{ component_hyphenated }}`. You can find these files on [GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}) or via [GetGrav.org](https://getgrav.org/downloads/plugins).
|
||||
|
||||
You should now have all the plugin files under
|
||||
|
||||
/your/site/grav/user/plugins/{{ component_hyphenated }}
|
||||
|
||||
> NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/{{ developer_hyphenated }}/grav-plugin-{{ component_hyphenated }}/blob/main/blueprints.yaml).
|
||||
|
||||
### Admin Plugin
|
||||
|
||||
If you use the Admin Plugin, you can install the plugin directly by browsing the `Plugins`-menu and clicking on the `Add` button.
|
||||
|
||||
## Configuration
|
||||
|
||||
Before configuring this plugin, you should copy the `user/plugins/{{ component_hyphenated }}/{{ component_hyphenated }}.yaml` to `user/config/plugins/{{ component_hyphenated }}.yaml` and only edit that copy.
|
||||
|
||||
Here is the default configuration and an explanation of available options:
|
||||
|
||||
```yaml
|
||||
enabled: true
|
||||
```
|
||||
|
||||
Note that if you use the Admin Plugin, a file with your configuration named {{component_hyphenated}}.yaml will be saved in the `user/config/plugins/`-folder once the configuration is saved in the Admin.
|
||||
|
||||
## Usage
|
||||
|
||||
**Describe how to use the plugin.**
|
||||
|
||||
## Credits
|
||||
|
||||
**Did you incorporate third-party code? Want to thank somebody?**
|
||||
|
||||
## To Do
|
||||
|
||||
- [ ] Future plans, if any
|
||||
|
||||
37
plugins/devtools/components/plugin/flex/blueprints.yaml.twig
Normal file
37
plugins/devtools/components/plugin/flex/blueprints.yaml.twig
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{% set githubid = component.author.githubid ?: component.author.name|hyphenize -%}
|
||||
name: {{ component.name|titleize }}
|
||||
slug: {{ component.name|hyphenize }}
|
||||
type: plugin
|
||||
version: 0.1.0
|
||||
description: {{ component.description }}
|
||||
icon: plug
|
||||
author:
|
||||
name: {{ component.author.name }}
|
||||
email: {{ component.author.email }}
|
||||
homepage: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}
|
||||
demo: http://demo.yoursite.com
|
||||
keywords: grav, plugin, etc
|
||||
bugs: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}/issues
|
||||
docs: https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}/blob/develop/README.md
|
||||
license: MIT
|
||||
|
||||
dependencies:
|
||||
- { name: grav, version: '>=1.6.0' }
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
enabled:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.PLUGIN_STATUS
|
||||
highlight: 1
|
||||
default: 0
|
||||
options:
|
||||
1: PLUGIN_ADMIN.ENABLED
|
||||
0: PLUGIN_ADMIN.DISABLED
|
||||
validate:
|
||||
type: bool
|
||||
text_var:
|
||||
type: text
|
||||
label: PLUGIN_{{ component.name|underscorize|upper }}.TEXT_VARIABLE
|
||||
help: PLUGIN_{{ component.name|underscorize|upper }}.TEXT_VARIABLE_HELP
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
title: '{{ component.flex_name|capitalize }}'
|
||||
description: '{{ component.flex_name|capitalize }}'
|
||||
type: flex-objects
|
||||
|
||||
# Flex Configuration
|
||||
config:
|
||||
# Administration Configuration
|
||||
admin:
|
||||
# Admin router (optional)
|
||||
router:
|
||||
path: '/{{ component.flex_name|lower|underscorize }}'
|
||||
|
||||
# Admin menu (optional)
|
||||
menu:
|
||||
list:
|
||||
route: '/{{ component.flex_name|lower|underscorize }}'
|
||||
title: '{{ component.flex_name|capitalize }}'
|
||||
icon: fa-address-card-o
|
||||
# Authorization to collection admin
|
||||
authorize: ['admin.{{ component.flex_name|lower|underscorize }}.list', 'admin.super']
|
||||
# Priority -10 .. 10 (highest goes up)
|
||||
priority: 2
|
||||
|
||||
# Admin template type / folder
|
||||
template: default
|
||||
|
||||
# Permissions
|
||||
permissions:
|
||||
# Primary permissions
|
||||
admin.{{ component.flex_name|lower|underscorize }}:
|
||||
type: crudpl
|
||||
label: '{{ component.flex_name|capitalize }}'
|
||||
|
||||
# List view
|
||||
list:
|
||||
title: name
|
||||
fields:
|
||||
published:
|
||||
field:
|
||||
type: toggle
|
||||
label: Published
|
||||
width: 8
|
||||
name:
|
||||
link: edit
|
||||
description:
|
||||
|
||||
# Edit View
|
||||
edit:
|
||||
title:
|
||||
template: '{{ object.name }}'
|
||||
|
||||
# Preview View
|
||||
preview:
|
||||
enabled: false
|
||||
route:
|
||||
#template: '/plugins/flex-objects/directory:contacts'
|
||||
|
||||
# Data Export
|
||||
export:
|
||||
enabled: true
|
||||
method: 'jsonSerialize'
|
||||
formatter:
|
||||
class: 'Grav\Framework\File\Formatter\YamlFormatter'
|
||||
filename: '{{ component.flex_name|lower|underscorize }}'
|
||||
|
||||
# Site Configuration
|
||||
site:
|
||||
templates:
|
||||
collection:
|
||||
# Lookup for the template layout files for collections of objects
|
||||
paths:
|
||||
- 'flex/{TYPE}/collection/{LAYOUT}{EXT}'
|
||||
object:
|
||||
# Lookup for the template layout files for objects
|
||||
paths:
|
||||
- 'flex/{TYPE}/object/{LAYOUT}{EXT}'
|
||||
defaults:
|
||||
# Default template {TYPE}; overridden by filename of this blueprint if template folder exists
|
||||
type: '{{ component.flex_name|lower|underscorize }}'
|
||||
# Default template {LAYOUT}; can be overridden in render calls (usually Twig in templates)
|
||||
layout: default
|
||||
|
||||
# Data Configuration
|
||||
data:
|
||||
# Object class to be used, allowing custom methods for the object
|
||||
object: 'Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }}\{{ component.flex_name|camelize }}Object'
|
||||
# Collection class to be used, allowing custom methods for the collections
|
||||
collection: 'Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }}\{{ component.flex_name|camelize }}Collection'
|
||||
# Index class to be used, works as a quick database-like lookup index
|
||||
index: 'Grav\Common\Flex\Types\Generic\GenericIndex'
|
||||
storage:
|
||||
# Storage class, use single file storage (does not support images and assets)
|
||||
class: 'Grav\Framework\Flex\Storage\{{ component.flex_storage|capitalize }}Storage'
|
||||
options:
|
||||
formatter:
|
||||
# File formatter class, in this case the file is stored in markdown
|
||||
class: 'Grav\Framework\File\Formatter\JsonFormatter'
|
||||
# JSON file where all the objects will be stored
|
||||
folder: user-data://{{ component.flex_name|underscorize }}
|
||||
search:
|
||||
# Search options
|
||||
options:
|
||||
contains: 1
|
||||
# Fields to be searched
|
||||
fields:
|
||||
- name
|
||||
- description
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
published:
|
||||
type: toggle
|
||||
label: Published
|
||||
highlight: 1
|
||||
default: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
required: true
|
||||
name:
|
||||
type: text
|
||||
label: Name
|
||||
validate:
|
||||
required: true
|
||||
description:
|
||||
type: text
|
||||
label: Description
|
||||
validate:
|
||||
required: true
|
||||
0
plugins/devtools/components/plugin/flex/classes/.gitkeep
Normal file
0
plugins/devtools/components/plugin/flex/classes/.gitkeep
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @package Grav\Common\Flex
|
||||
*
|
||||
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }};
|
||||
|
||||
use Grav\Common\Flex\Types\Generic\GenericCollection;
|
||||
|
||||
/**
|
||||
* Class {{ component.flex_name|camelize }}Collection
|
||||
* @package Grav\Common\Flex\Generic
|
||||
*
|
||||
* @extends FlexCollection<string,GenericObject>
|
||||
*/
|
||||
class {{ component.flex_name|camelize }}Collection extends GenericCollection
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @package Grav\Common\Flex
|
||||
*
|
||||
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Plugin\{{ component.name|camelize }}\Flex\Types\{{ component.flex_name|camelize }};
|
||||
|
||||
use Grav\Common\Flex\Types\Generic\GenericObject;
|
||||
|
||||
/**
|
||||
* Class {{ component.flex_name|camelize }}Object
|
||||
* @package Grav\Common\Flex\Generic
|
||||
*
|
||||
* @extends FlexObject<string,GenericObject>
|
||||
*/
|
||||
class {{ component.flex_name|camelize }}Object extends GenericObject
|
||||
{
|
||||
|
||||
}
|
||||
25
plugins/devtools/components/plugin/flex/composer.json.twig
Normal file
25
plugins/devtools/components/plugin/flex/composer.json.twig
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{% set githubid = component.author.githubid ?: component.author.name|hyphenize -%}
|
||||
{
|
||||
"name": "{{ githubid|lower }}/{{ component.name|hyphenize }}",
|
||||
"type": "grav-plugin",
|
||||
"description": "{{ component.description }}",
|
||||
"keywords": ["plugin"],
|
||||
"homepage": "https://github.com/{{ githubid }}/grav-plugin-{{ component.name|hyphenize }}",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "{{ component.author.name }}",
|
||||
"email": "{{ component.author.email }}",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Grav\\Plugin\\{{ component.name|camelize }}\\": "classes/"
|
||||
},
|
||||
"classmap": ["{{ component.name|hyphenize }}.php"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
en:
|
||||
PLUGIN_{{ component.name|underscorize|upper }}:
|
||||
TEXT_VARIABLE: Text Variable
|
||||
TEXT_VARIABLE_HELP: Text to add to the top of a page
|
||||
76
plugins/devtools/components/plugin/flex/plugin.php.twig
Normal file
76
plugins/devtools/components/plugin/flex/plugin.php.twig
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
namespace Grav\Plugin;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Grav\Common\Plugin;
|
||||
use Grav\Events\FlexRegisterEvent;
|
||||
|
||||
/**
|
||||
* Class {{ component.name|camelize }}Plugin
|
||||
* @package Grav\Plugin
|
||||
*/
|
||||
class {{ component.name|camelize }}Plugin extends Plugin
|
||||
{
|
||||
public $features = [
|
||||
'blueprints' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* The getSubscribedEvents() gives the core a list of events
|
||||
* that the plugin wants to listen to. The key of each
|
||||
* array section is the event that the plugin listens to
|
||||
* and the value (in the form of an array) contains the
|
||||
* callable (or function) as well as the priority. The
|
||||
* higher the number the higher the priority.
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
'onPluginsInitialized' => [
|
||||
// Uncomment following line when plugin requires Grav < 1.7
|
||||
// ['autoload', 100000],
|
||||
['onPluginsInitialized', 0]
|
||||
],
|
||||
FlexRegisterEvent::class => [['onRegisterFlex', 0]],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Composer autoload
|
||||
*
|
||||
* @return ClassLoader
|
||||
*/
|
||||
public function autoload(): ClassLoader
|
||||
{
|
||||
return require __DIR__ . '/vendor/autoload.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the plugin
|
||||
*/
|
||||
public function onPluginsInitialized(): void
|
||||
{
|
||||
// Don't proceed if we are in the admin plugin
|
||||
if ($this->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable the main events we are interested in
|
||||
$this->enable([
|
||||
// Put your main events here
|
||||
]);
|
||||
}
|
||||
|
||||
public function onRegisterFlex($event): void
|
||||
{
|
||||
$flex = $event->flex;
|
||||
|
||||
$flex->addDirectoryType(
|
||||
'{{ component.flex_name|lower|underscorize }}',
|
||||
'blueprints://flex-objects/{{ component.flex_name|lower|underscorize }}.yaml'
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
2
plugins/devtools/components/plugin/flex/plugin.yaml.twig
Normal file
2
plugins/devtools/components/plugin/flex/plugin.yaml.twig
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
enabled: true
|
||||
text_var: Custom Text added by the **{{ component.name|titleize }}** plugin (disable plugin to remove)
|
||||
Loading…
Add table
Add a link
Reference in a new issue