<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
steirico / kirby-plugin-custom-add-fields example snippets
>
> class RemotePage extends Page {
> public static function hookPageCreate($page){
> // get value of add field remoteUrl
> $remoteUrl = $page->remoteUrl()->value();
>
> // fetch remote content
> $content = file_get_contents($remoteUrl);
>
> // update page field content
> $page->update(array(
> 'content' => $content
> ));
>
> // set slug according to add field title
> $page->changeSlug(Str::slug($page->title()->value()));
> }
> }
>
> try {
> // set slug according to add field title
> $page->changeSlug(Str::slug($page->title()->value()));
> } catch (Kirby\Exception\DuplicateException $e) {
> // A pages withe the same slug already exists.
> // Therefore, delete the newly created one.
> $page->delete(true);
> }
>