Skip to content

Commit fccb444

Browse files
committed
Support importing cover images via the new infrastructure
1 parent f5c8eba commit fccb444

File tree

1 file changed

+24
-0
lines changed
  • src/main/php/de/thekid/dialog/import

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php namespace de\thekid\dialog\import;
2+
3+
use de\thekid\dialog\processing\Files;
4+
5+
/** Imports the cover image */
6+
class Content extends Source {
7+
8+
public function entryFrom(Description $description): array<string, mixed> {
9+
return [
10+
'slug' => '@cover',
11+
'parent' => '~',
12+
'date' => $description->meta['date'],
13+
'title' => $description->meta['title'],
14+
'keywords' => $description->meta['keywords'] ?? [],
15+
'content' => $description->content,
16+
'locations' => [...$description->locations($description->meta['date']->getTimeZone())],
17+
'is' => ['cover' => true],
18+
];
19+
}
20+
21+
public function contentsIn(Files $files): iterable {
22+
yield from $this->mediaIn($files);
23+
}
24+
}

0 commit comments

Comments
 (0)