diff --git a/app/Entities/Episode.php b/app/Entities/Episode.php
index bc43df17..3fc08e5f 100644
--- a/app/Entities/Episode.php
+++ b/app/Entities/Episode.php
@@ -688,4 +688,16 @@ class Episode extends Entity
return url_to('episode-preview', (string) $this->preview_id);
}
+
+ /**
+ * Returns the episode's clip count
+ */
+ public function getClipCount(): int|string
+ {
+ if ($this->id === null) {
+ throw new RuntimeException('Episode must be created before getting number of video clips.');
+ }
+
+ return (new ClipModel())->getClipCount($this->podcast_id, $this->id);
+ }
}
diff --git a/app/Models/ClipModel.php b/app/Models/ClipModel.php
index 819d8e42..0e372614 100644
--- a/app/Models/ClipModel.php
+++ b/app/Models/ClipModel.php
@@ -173,6 +173,16 @@ class ClipModel extends Model
]);
}
+ public function getClipCount(int $podcastId, int $episodeId): int
+ {
+ return $this
+ ->where([
+ 'podcast_id' => $podcastId,
+ 'episode_id' => $episodeId,
+ ])
+ ->countAllResults();
+ }
+
public function clearVideoClipCache(int $clipId): void
{
cache()
diff --git a/themes/cp_admin/episode/_sidebar.php b/themes/cp_admin/episode/_sidebar.php
index 52b07631..d5c7f83e 100644
--- a/themes/cp_admin/episode/_sidebar.php
+++ b/themes/cp_admin/episode/_sidebar.php
@@ -6,9 +6,11 @@ $episodeNavigation = [
'items' => ['episode-view', 'episode-edit', 'episode-persons-manage', 'embed-add'],
],
'clips' => [
- 'icon' => 'clapperboard',
- 'items' => ['video-clips-list', 'video-clips-create', 'soundbites-list', 'soundbites-create'],
- 'add-cta' => 'video-clips-create',
+ 'icon' => 'clapperboard',
+ 'items' => ['video-clips-list', 'video-clips-create', 'soundbites-list', 'soundbites-create'],
+ 'count' => $episode->getClipCount(),
+ 'count-route' => 'video-clips-list',
+ 'add-cta' => 'video-clips-create',
],
]; ?>
diff --git a/themes/cp_admin/podcast/create.php b/themes/cp_admin/podcast/create.php
index a14f0950..62c3b642 100644
--- a/themes/cp_admin/podcast/create.php
+++ b/themes/cp_admin/podcast/create.php
@@ -56,27 +56,6 @@
isChecked="false" >= lang('Podcast.form.type.serial') ?>
-
-
-
-
-
-
-
= lang('Podcast.form.handle') ?>
-
-
-
-
-
-
-
+
+
+
+
= lang('Podcast.form.handle') ?>
+
+
+
+
+
+
+
+
+
= lang('Podcast.form.premium_by_default') ?>
diff --git a/themes/cp_admin/podcast/edit.php b/themes/cp_admin/podcast/edit.php
index 930b4a4d..4de46ec0 100644
--- a/themes/cp_admin/podcast/edit.php
+++ b/themes/cp_admin/podcast/edit.php
@@ -78,27 +78,6 @@
isChecked="= $podcast->type === 'serial' ? 'true' : 'false' ?>" >= lang('Podcast.form.type.serial') ?>
-
-
-
-
-
-
-
= lang('Podcast.form.handle') ?>
-
-
-
-
-
-
-
-
+
+
+
+
= lang('Podcast.form.handle') ?>
+
+
+
+
+
+
+
+
+
+
= lang('Podcast.form.premium_by_default') ?>