Skip to content

Commit

Permalink
trigger panel.page.create hook
Browse files Browse the repository at this point in the history
  • Loading branch information
texnixe committed May 29, 2016
1 parent 1be88b7 commit e6a8dad
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 0.7

- trigger panel.page.create hook
- update readme.md

Version 0.6

- rename field, clone caused issues
Expand Down
4 changes: 3 additions & 1 deletion field/duplicate/duplicate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Clone Field for Kirby CMS (v. 2.3.0)
*
* @author Sonja Broda - info@exniq.de
* @version 0.6
* @version 0.7
*
*/

Expand Down Expand Up @@ -100,6 +100,8 @@ public function routes() {

}

kirby()->trigger('panel.page.create', $newPage);

return 'The new page has been created' . ' <i class="icon fa fa-close"></i>';

} catch(Exception $e) {
Expand Down
16 changes: 14 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ This custom Kirby field allows you to clone a page in the panel.

Put the field into `/site/fields`; create the folder if it does not exist yet.

## In your blueprint
Your structure should then look like this:

```
site/
fields/
duplicate/
assets/
duplicate.php
```

## In your blueprint

```yaml
fields:
clone:
type: duplicate
Expand All @@ -22,7 +32,7 @@ You can provide a placeholder text and a buttontext. The examples above are the
This will create a button in your Panel form.
## Use
## Usage
1. Click on the "Clone Page" button => an input field is shown.
2. Enter the title of the new page into the input field and press `ENTER`.
Expand All @@ -31,6 +41,8 @@ This will create a button in your Panel form.
## Limitations

- If you are on a multi-lingual installation, the field is only shown in the default language. It does, however, create a page in every available language.
- The title entered into the input field will be used for all languages
- If you use the `URL-key` field in multi-lingual installations, make sure to change the value of this field in your new pages to prevent errors.

## Author

Expand Down

0 comments on commit e6a8dad

Please sign in to comment.