Hey all,
I am in the process of migrating content from a drupal-database to kirby, grabbing everything out of the database tables, and create the pages via ->createChild() in Kirby.
My last problem is the import of the PDF files that were uploaded in drupal.
I already built the function to grab the files from the url and put them in the folder thats being created.
What I am stuck with, is simply connecting the pdf file to the “type: files” field.
I can manually edit the .txt file and add “- filename.pdf” to the right files field (“typefilesfield”) and the file is perfectly preselected in the panel and also showing in the frontend.
But I can’t get this done automatically inside the ->createChild() function.
So my problem is:
All strings inside the ‘content’ => array get attached to the fields. Theres only a problem with the files field(‘typefilesfield’). With the following code it always stays empty and won’t receive the string.
I guess I can’t just simply add a string to the files field in this way, but I can’t wrap my head around how to write it.
Thanks so much in advance for everyone thats trying to help.
Daniel
PHP:
$article = page('db-test')->createChild([
'slug' => 'some slug here',
'template' => 'the template name',
'content' => [
'fileurl' => 'fileurlhere',
'title' => 'titlehere',
'typefilesfield' => '- filename.pdf'
]
]);
YML:
typefilesfield:
label: Type Files Field
type: files