From 95c629c03046ce766040af201a6ae1b452c4b9b2 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Mon, 23 Dec 2024 11:29:56 +0530 Subject: [PATCH] Adds actions support in custom fields --- css/settings.css | 22 ++++++++++- includes/admin/feedzy-rss-feeds-actions.php | 10 +++++ includes/admin/feedzy-rss-feeds-import.php | 11 ++++-- includes/views/import-metabox-edit.php | 2 + includes/views/js/import-metabox-edit.js | 12 ++++++ js/ActionPopup/index.js | 43 +++++++++++++++++++++ 6 files changed, 96 insertions(+), 4 deletions(-) diff --git a/css/settings.css b/css/settings.css index 44ecaba9..86b75106 100644 --- a/css/settings.css +++ b/css/settings.css @@ -2000,7 +2000,8 @@ li.draggable-item .components-panel__body-toggle.components-button{ .fz-action-control .fz-hide-icon .components-panel__arrow { display: none; } -.tagify__filter-icon{ +.tagify__filter-icon, +.fz-action-icon { width: 19px; height: 19px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M14.5 13.8002C13.4 13.8002 12.4 14.5002 12.1 15.6002H4V17.0002H12.1C12.4 18.0002 13.4 18.8002 14.5 18.8002C15.6 18.8002 16.6 18.1002 16.9 17.0002H20V15.5002H16.9C16.6 14.5002 15.6 13.8002 14.5 13.8002ZM11.9 7.0002C11.6 6.0002 10.6 5.2002 9.5 5.2002C8.4 5.2002 7.4 6.0002 7.1 7.0002H4V8.5002H7.1C7.4 9.5002 8.4 10.3002 9.5 10.3002C10.6 10.3002 11.6 9.6002 11.9 8.5002H20V7.0002H11.9Z' fill='%23050505'/%3E%3C/svg%3E"); @@ -2461,6 +2462,25 @@ li.draggable-item .components-panel__body-toggle.components-button{ .fz-panel-tab .fz-panel-tab__content .components-base-control .components-datetime__timezone { display: inline-block; } + +.fz-form-group .custom_fields .fz-form-group { + position: relative; +} +.fz-form-group .custom_fields .fz-form-group .fz-action-icon { + position: absolute; + top: 50%; + right: 2px; + cursor: pointer; + transform: translateY(-50%); + width: 40px; + height: 40px; + display: grid; + place-items: center; +} +.fz-form-group .custom_fields .fz-form-group .fz-action-icon.disabled { + pointer-events: none; + opacity: 0.5; +} .fz-prompt-button { gap: 7px; display: flex; diff --git a/includes/admin/feedzy-rss-feeds-actions.php b/includes/admin/feedzy-rss-feeds-actions.php index 36ff42d7..e64a9e60 100644 --- a/includes/admin/feedzy-rss-feeds-actions.php +++ b/includes/admin/feedzy-rss-feeds-actions.php @@ -597,5 +597,15 @@ function() { } return $dom->saveHTML(); } + + /** + * Get custom field value. + */ + private function custom_field() { + if ( ! empty( $this->result ) ) { + return $this->result; + } + return $this->default_value; + } } } diff --git a/includes/admin/feedzy-rss-feeds-import.php b/includes/admin/feedzy-rss-feeds-import.php index 8fb6bf71..e21005ae 100644 --- a/includes/admin/feedzy-rss-feeds-import.php +++ b/includes/admin/feedzy-rss-feeds-import.php @@ -418,8 +418,9 @@ public function feedzy_import_feed_options() { // maybe more options are required from pro? $pro_options = apply_filters( 'feedzy_metabox_options', array(), $post->ID ); - $import_custom_fields = get_post_meta( $post->ID, 'imports_custom_fields', true ); - $import_feed_limit = get_post_meta( $post->ID, 'import_feed_limit', true ); + $import_custom_fields = get_post_meta( $post->ID, 'imports_custom_fields', true ); + $custom_fields_actions = get_post_meta( $post->ID, 'imports_custom_field_actions', true ); + $import_feed_limit = get_post_meta( $post->ID, 'import_feed_limit', true ); if ( empty( $import_feed_limit ) ) { $import_feed_limit = 10; } @@ -1977,7 +1978,11 @@ function( $term ) { } } - do_action( 'feedzy_import_extra', $job, $item_obj, $new_post_id, $import_errors, $import_info ); + do_action( 'feedzy_import_extra', $job, $item_obj, $new_post_id, $import_errors, $import_info, array( + 'translation_lang' => $import_translation_lang, + 'language_code' => $language_code, + 'item' => $item, + ) ); if ( ! empty( $import_featured_img ) && 'attachment' !== $import_post_type ) { $image_source_url = ''; diff --git a/includes/views/import-metabox-edit.php b/includes/views/import-metabox-edit.php index 3904a436..0de436cf 100644 --- a/includes/views/import-metabox-edit.php +++ b/includes/views/import-metabox-edit.php @@ -558,6 +558,8 @@ class="fz-switch-toggle" type="checkbox" value="yes"
+ +