diff --git a/changelog.md b/changelog.md index 7736a73..dd8cd69 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +Version 0.7 + +- trigger panel.page.create hook +- update readme.md + Version 0.6 - rename field, clone caused issues diff --git a/field/duplicate/duplicate.php b/field/duplicate/duplicate.php index 2ca2552..287fefd 100755 --- a/field/duplicate/duplicate.php +++ b/field/duplicate/duplicate.php @@ -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 * */ @@ -100,6 +100,8 @@ public function routes() { } + kirby()->trigger('panel.page.create', $newPage); + return 'The new page has been created' . ' '; } catch(Exception $e) { diff --git a/readme.md b/readme.md index 56df0e1..125f064 100644 --- a/readme.md +++ b/readme.md @@ -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 @@ -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`. @@ -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