|
@@ -168,30 +168,32 @@ class DistVideoController extends AdminDistController
|
|
|
CommonHelper::seoReplace();
|
|
|
});
|
|
|
$form->saving(function (Form $form) {
|
|
|
- $form->dist_id =getDistributorId();
|
|
|
+ if ($form->input('title')) {
|
|
|
+ $form->dist_id =getDistributorId();
|
|
|
|
|
|
- $id = $form->getKey();
|
|
|
- $form->slug=CommonHelper::slug_fix($form->slug);
|
|
|
- if ($form->slug != '') {
|
|
|
- if (DistVideo::isRepeatedSlug($id, $form->slug)) {
|
|
|
-
|
|
|
- return $form->response()->error(admin_trans_label('url_repeated'));
|
|
|
+ $id = $form->getKey();
|
|
|
+ $form->slug=CommonHelper::slug_fix($form->slug);
|
|
|
+ if ($form->slug != '') {
|
|
|
+ if (DistVideo::isRepeatedSlug($id, $form->slug)) {
|
|
|
+
|
|
|
+ return $form->response()->error(admin_trans_label('url_repeated'));
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if ($form->slug == '') {
|
|
|
- $form->slug = DistVideo::generateSlug($form->title, $id);
|
|
|
- }
|
|
|
-
|
|
|
- if ($form->seo_title == '') {
|
|
|
- $form->seo_title = $form->title;
|
|
|
- }
|
|
|
-
|
|
|
- if (strpos($form->video_url, '<iframe') !== false) {
|
|
|
-
|
|
|
- if (preg_match('/<iframe[^>]+src="([^"]+)"/', $form->video_url, $matches)) {
|
|
|
- $src = $matches[1];
|
|
|
- $form->video_url = $src;
|
|
|
+
|
|
|
+ if ($form->slug == '') {
|
|
|
+ $form->slug = DistVideo::generateSlug($form->title, $id);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($form->seo_title == '') {
|
|
|
+ $form->seo_title = $form->title;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strpos($form->video_url, '<iframe') !== false) {
|
|
|
+
|
|
|
+ if (preg_match('/<iframe[^>]+src="([^"]+)"/', $form->video_url, $matches)) {
|
|
|
+ $src = $matches[1];
|
|
|
+ $form->video_url = $src;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|