Initial commit
This commit is contained in:
commit
65e0da7e11
1397 changed files with 596542 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
.modules-layout__preview {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.modules-layout__preview:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.modules-layout__preview--bottom {
|
||||
border-bottom: none;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
3
site/OFF_plugins/sortable/fields/modules/controller.php
Normal file
3
site/OFF_plugins/sortable/fields/modules/controller.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
class ModulesFieldController extends LukasKleinschmidt\Sortable\Controllers\Field {}
|
||||
31
site/OFF_plugins/sortable/fields/modules/modules.php
Normal file
31
site/OFF_plugins/sortable/fields/modules/modules.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
class ModulesField extends SortableField {
|
||||
|
||||
public $add = true;
|
||||
public $copy = true;
|
||||
public $paste = true;
|
||||
public $layout = 'module';
|
||||
public $variant = 'modules';
|
||||
public $actions = array(
|
||||
'edit',
|
||||
'duplicate',
|
||||
'delete',
|
||||
'toggle',
|
||||
);
|
||||
|
||||
static public $assets = array(
|
||||
'css' => array(
|
||||
'modules.css',
|
||||
),
|
||||
);
|
||||
|
||||
public function parent() {
|
||||
return Kirby\Modules\Settings::parentUid();
|
||||
}
|
||||
|
||||
public function prefix() {
|
||||
return Kirby\Modules\Settings::templatePrefix();
|
||||
}
|
||||
|
||||
}
|
||||
164
site/OFF_plugins/sortable/fields/modules/readme.md
Normal file
164
site/OFF_plugins/sortable/fields/modules/readme.md
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
# Kirby Modules Field
|
||||
|
||||
This field extends the `sortable` field and adds some presets and features to help you manage your modules.
|
||||
To use this field you have to install the [modules-plugin](https://github.com/getkirby-plugins/modules-plugin).
|
||||
|
||||
### Some of the features
|
||||
- Preset `parent` and `prefix` to match those set by the modules-plugin
|
||||
- Adds a [preview](#preview) if provided
|
||||
|
||||

|
||||
|
||||
## Blueprint
|
||||
|
||||
After installing the plugin, you can use the new field type `modules`.
|
||||
This blueprint shows all available options and their defaults.
|
||||
|
||||
```yml
|
||||
fields:
|
||||
title:
|
||||
label: Title
|
||||
type: text
|
||||
|
||||
modules:
|
||||
label: Modules
|
||||
type: modules
|
||||
|
||||
add: true
|
||||
copy: true
|
||||
paste: true
|
||||
limit: false
|
||||
variant: modules
|
||||
|
||||
actions:
|
||||
- edit
|
||||
- duplicate
|
||||
- delete
|
||||
- toggle
|
||||
|
||||
options:
|
||||
preview: true
|
||||
limit: false
|
||||
edit: true
|
||||
duplicate: true
|
||||
delete: true
|
||||
toggle: true
|
||||
...
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
The following examples show and explain some of the possible settings.
|
||||
|
||||
### Preview
|
||||
|
||||
A preview is a normal PHP file with the HTML and PHP code that defines your preview. The preview has access to the following variables:
|
||||
|
||||
- `$page` is the page on which the module appears
|
||||
- `$module` is the module subpage, which you can use to access the fields from your module blueprint as well as module files
|
||||
- `$moduleName` is the name of the module such as text or gallery
|
||||
|
||||
The preview file must be in the same folder as the module itself.
|
||||
The module directory looks something like this:
|
||||
|
||||
```
|
||||
site/modules/
|
||||
gallery/
|
||||
gallery.html.php
|
||||
gallery.yml
|
||||
|
||||
# The preview file
|
||||
gallery.preview.php
|
||||
...
|
||||
```
|
||||
|
||||
### Preview options
|
||||
|
||||
Previews are enabled by default. Set `preview` to `false` to disable the preview.
|
||||
It is also possible to change the position in the module.
|
||||
|
||||
```yml
|
||||
options:
|
||||
# Render the preview at the bottom
|
||||
preview: bottom
|
||||
|
||||
# Or at the top
|
||||
preview: top
|
||||
preview: true
|
||||
```
|
||||
|
||||
|
||||
### Limit the number of visible modules
|
||||
|
||||
```yml
|
||||
modules_field:
|
||||
label: Modules
|
||||
type: modules
|
||||
|
||||
# Allow 3 visible modules overall
|
||||
limit: 3
|
||||
|
||||
# Template specific option
|
||||
options:
|
||||
module.gallery:
|
||||
# Allow only 1 visible gallery module
|
||||
limit: 1
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Is it a module or a section?
|
||||
|
||||
Change the naming.
|
||||
|
||||
```yml
|
||||
# Modules is fine
|
||||
variant: modules
|
||||
|
||||
# Nah sections it is
|
||||
variant: sections
|
||||
```
|
||||
|
||||
### Changing actions
|
||||
|
||||
To change the actions or remove an action completely from the modules, you must specify the `actions` array in the blueprint.
|
||||
|
||||
```yml
|
||||
# Default
|
||||
actions:
|
||||
- edit
|
||||
- duplicate
|
||||
- delete
|
||||
- toggle
|
||||
```
|
||||
|
||||

|
||||
|
||||
```yml
|
||||
actions:
|
||||
- edit
|
||||
- toggle
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Disabling an action
|
||||
|
||||
```yml
|
||||
options:
|
||||
edit: false
|
||||
duplicate: false
|
||||
delete: true
|
||||
toggle: true
|
||||
|
||||
# Template specific options
|
||||
module.gallery:
|
||||
edit: true
|
||||
duplicate: true
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Requirements
|
||||
|
||||
- [Kirby Modules Plugin](https://github.com/getkirby-plugins/modules-plugin) 1.3+
|
||||
32
site/OFF_plugins/sortable/fields/modules/template.php
Normal file
32
site/OFF_plugins/sortable/fields/modules/template.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<label class="label">
|
||||
<?= $field->label(); ?>
|
||||
<?= $field->counter(); ?>
|
||||
<?php if($field->add()) echo $field->action('add'); ?>
|
||||
</label>
|
||||
|
||||
<?php if($field->entries()->count()): ?>
|
||||
<?= $field->layouts(); ?>
|
||||
<?php else: ?>
|
||||
<div class="sortable__empty">
|
||||
<?php
|
||||
echo $field->l('field.sortable.empty');
|
||||
if($field->add()) {
|
||||
echo $field->action('add', ['label' => $field->l('field.sortable.add.first'), 'icon' => '', 'class' => '']);
|
||||
if($field->paste()) {
|
||||
echo $field->l('field.sortable.or');
|
||||
echo $field->action('paste', ['label' => $field->l('field.sortable.paste.first'), 'icon' => '', 'class' => '']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="sortable__navigation">
|
||||
<?php
|
||||
if($field->copy()) echo $field->action('copy');
|
||||
if($field->add()) {
|
||||
if($field->paste()) echo $field->action('paste');
|
||||
echo $field->action('add');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue