diff --git a/public/site/blueprints/pages/geoformat.yml b/public/site/blueprints/pages/geoformat.yml index 301faa9..3104955 100644 --- a/public/site/blueprints/pages/geoformat.yml +++ b/public/site/blueprints/pages/geoformat.yml @@ -22,6 +22,7 @@ tabs: label: Media de couverture type: files query: page.coverFiles + text: "{{ file.coverLabel }}" multiple: false width: 1/2 text: diff --git a/public/site/blueprints/pages/narrative.yml b/public/site/blueprints/pages/narrative.yml index 4113291..23dc680 100644 --- a/public/site/blueprints/pages/narrative.yml +++ b/public/site/blueprints/pages/narrative.yml @@ -18,6 +18,8 @@ tabs: cover: label: Image de couverture type: files + query: page.coverFiles + text: "{{ file.coverLabel }}" multiple: false width: 1/2 introduction: diff --git a/public/site/models/geoformat.php b/public/site/models/geoformat.php deleted file mode 100644 index 6f49082..0000000 --- a/public/site/models/geoformat.php +++ /dev/null @@ -1,13 +0,0 @@ -files()->add( - $this->children()->filterBy('intendedTemplate', 'map')->files() - ); - } -} diff --git a/public/site/plugins/cover-files/index.php b/public/site/plugins/cover-files/index.php new file mode 100644 index 0000000..d49d870 --- /dev/null +++ b/public/site/plugins/cover-files/index.php @@ -0,0 +1,19 @@ + [ + 'coverFiles' => function () { + return $this->files()->add( + $this->children()->filterBy('intendedTemplate', 'map')->files() + ); + } + ], + 'fileMethods' => [ + 'coverLabel' => function () { + if ($this->parent()->intendedTemplate()->name() === 'map') { + return 'Carte ' . $this->parent()->title(); + } + return $this->filename(); + } + ] +]);