From e7eec48e7bc06a9aa907db01ed3e5b536e7dd8be Mon Sep 17 00:00:00 2001 From: Yassine Doghri <yassine@doghri.fr> Date: Wed, 9 Feb 2022 17:44:24 +0000 Subject: [PATCH] feat(podcast-form): add new_feed_url field to set an url when changing domain or host --- app/Models/PodcastModel.php | 1 + modules/Admin/Controllers/PodcastController.php | 3 +++ modules/Admin/Language/en/Podcast.php | 2 ++ modules/Admin/Language/fr/Podcast.php | 2 ++ themes/cp_admin/podcast/edit.php | 8 ++++++++ 5 files changed, 16 insertions(+) diff --git a/app/Models/PodcastModel.php b/app/Models/PodcastModel.php index 68d1e1d10b..6b1806330b 100644 --- a/app/Models/PodcastModel.php +++ b/app/Models/PodcastModel.php @@ -94,6 +94,7 @@ class PodcastModel extends Model 'language_code' => 'required', 'category_id' => 'required', 'owner_email' => 'required|valid_email', + 'new_feed_url' => 'valid_url|permit_empty', 'type' => 'required', 'created_by' => 'required', 'updated_by' => 'required', diff --git a/modules/Admin/Controllers/PodcastController.php b/modules/Admin/Controllers/PodcastController.php index 8cbbcb96c9..f1e6aa8794 100644 --- a/modules/Admin/Controllers/PodcastController.php +++ b/modules/Admin/Controllers/PodcastController.php @@ -328,6 +328,9 @@ class PodcastController extends BaseController 'payment_pointer' ) === '' ? null : $this->request->getPost('payment_pointer'); $this->podcast->custom_rss_string = $this->request->getPost('custom_rss'); + $this->podcast->new_feed_url = $this->request->getPost('new_feed_url') === '' ? null : $this->request->getPost( + 'new_feed_url' + ); $this->podcast->partner_id = $partnerId; $this->podcast->partner_link_url = $partnerLinkUrl; $this->podcast->partner_image_url = $partnerImageUrl; diff --git a/modules/Admin/Language/en/Podcast.php b/modules/Admin/Language/en/Podcast.php index 739767e4ad..21bd5ac047 100644 --- a/modules/Admin/Language/en/Podcast.php +++ b/modules/Admin/Language/en/Podcast.php @@ -88,6 +88,8 @@ return [ 'If you need RSS tags that Castopod does not handle, set them here.', 'custom_rss' => 'Custom RSS tags for the podcast', 'custom_rss_hint' => 'This will be injected within the â¬channelâ tag.', + 'new_feed_url' => 'New feed URL', + 'new_feed_url_hint' => 'Use this field when you move to another domain or podcast hosting platform. By default, the value is set to the current RSS URL if the podcast is imported.', 'partnership' => 'Partnership', 'partner_id' => 'ID', 'partner_link_url' => 'Link URL', diff --git a/modules/Admin/Language/fr/Podcast.php b/modules/Admin/Language/fr/Podcast.php index 3336fd5890..01e2aebf6f 100644 --- a/modules/Admin/Language/fr/Podcast.php +++ b/modules/Admin/Language/fr/Podcast.php @@ -90,6 +90,8 @@ return [ 'Si vous avez besoin d’une balise que nous n’avons pas couverte, définissez-la ici.', 'custom_rss' => 'Balises RSS personnalisées pour le podcast', 'custom_rss_hint' => 'Ceci sera injecté dans la balise â¬channelâ.', + 'new_feed_url' => 'URL du nouveau flux', + 'new_feed_url_hint' => 'Utilisez ce champ lorsque vous déplacez ce podcast vers un autre domaine ou que vous changez d’hébergeur. Par défaut, ce champ est rempli avec l’URL du flux actuel si le podcast est importé.', 'partnership' => 'Partenariat', 'partner_id' => 'ID', 'partner_link_url' => 'URL lien', diff --git a/themes/cp_admin/podcast/edit.php b/themes/cp_admin/podcast/edit.php index 2f6de9d2b9..10e32c3354 100644 --- a/themes/cp_admin/podcast/edit.php +++ b/themes/cp_admin/podcast/edit.php @@ -221,6 +221,14 @@ hint="<?= lang('Podcast.form.custom_rss_hint') ?>" content="<?= esc($podcast->custom_rss_string) ?>" /> +<Forms.Field + name="new_feed_url" + type="url" + label="<?= lang('Podcast.form.new_feed_url') ?>" + hint="<?= lang('Podcast.form.new_feed_url_hint') ?>" + value="<?= $podcast->new_feed_url ?>" +/> + </Forms.Section> <Forms.Section -- GitLab