[WordPress] 外掛分享: Pods Gravity Forms Add-On

首頁外掛目錄 › Pods Gravity Forms Add-On
WordPress 外掛 Pods Gravity Forms Add-On 的封面圖片
1,000+
安裝啟用
★★★★★
5/5 分(7 則評價)
23 天前
最後更新
100%
問題解決
WordPress 6.3+ PHP 7.2+ v1.6.0 上架:2016-03-03

內容簡介

需要 Pods 2.4+,Gravity Forms 1.9+。

請到 pods.io 查看使用者指南、論壇及其他資源,以協助您開發 Pods。

若有問題回報或功能請求,請到 GitHub。

特別感謝 Rocketgenius 的贊助支持,以及 Naomi C. Bush 在初始的附加功能 UI 工作中提供的幫助。

WP-CLI 命令以同步條目

這個外掛提供了從表單提交和條目編輯畫面同步條目的能力。要在設定 Pods Gravity Form Feed 之前同步所有條目,您可以運行 WP-CLI 命令。

範例 1:同步表單 123 的所有條目,使用第一個啟用的 Pod feed

wp pods-gf sync --form=123

範例 2:使用特定的 feed(即使其未啟用)同步表單 123 的所有條目

wp pods-gf sync --form=123 --feed=2

將 GF 列表欄位映射到 Pods 關聯欄位

您可以將 GF 列表欄位映射到與另一個 Pod 相關的關聯欄位。使用以下範例,您可以自定義自動映射的工作方式。預設情況下,清單列會映射到具有相同標籤的 Pod 欄位。

範例 1:自定義列表所對應的相關 Pod 欄位,用於表單 ID 1、欄位 ID 2

您可以使用 pods_gf_field_columns_mapping 篩選器自定義清單欄位列,其具有表單 ID 和欄位 ID 變量(pods_gf_field_columns_mapping_{form_id} 和 pods_gf_field_columns_mapping_{form_id}_{field_id})。

add_filter( 'pods_gf_field_columns_mapping_1_2', 'my_columns_mapping', 10, 4 );

/**
* 為相關的 POD 欄位篩選列表列對應關係。
*
* @param array $columns 列表欄位列。
* @param array $form GF 表單。
* @param GF_Field $gf_field GF 欄位資料。
* @param Pods $pod Pods 物件。
*
* @return array
*/
function my_columns_mapping( $columns, $form, $gf_field, $related_obj ) {

$columns[0] = 'first_field';
$columns[1] = 'second_field';
$columns[2] = 'third_field';

return $columns;

}

範例 2:自定義表單 ID 1、欄位 ID 2 的列表行

您可以使用 pods_gf_field_column_row 篩選器自定義清單欄位行,其具有表單 ID 和欄位 ID 變量(pods_gf_field_column_row_{form_id} 和 pods_gf_field_column_row_{form_id}_{field_id})。

add_filter( 'pods_gf_field_column_row_1_2', 'my_column_row_override', 10, 6 );

/**
* 為關聯欄位儲存篩選列表欄位行。
*
* @param array $row 列表欄位行。
* @param array $columns 列表欄位列。
* @param array $form GF 表單。
* @param GF_Field $gf_field GF 欄位資料。
* @param array $options Pods GF 選項。
* @param Pods|false $related_obj 相關的 Pod 物件。
*
* @return array
*/
function my_column_row_override( $row, $columns, $form, $gf_field, $options, $related_obj ) {

// 根據特定欄位的值更新某些行欄位。
if ( ! empty( $row['user_relationship_field'] ) ) {
$user = get_userdata( (int) $row['user'] );

//將文章標題設置為與使用者顯示名稱相同。
if ( $user && ! is_wp_error( $user ) ) {
$row['post_title'] = $user->displa

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.6.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Pods Gravity Forms Add-On」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Requires: Pods 3.0+, Gravity Forms 1.9+
Demo: Want to try Pods GF out? Check out the Gravity Forms Live Demo and install the Pods and Pods Gravity Forms plugins once you’re there
Bugs/Ideas: Please report bugs or request features on GitHub

Special thanks to Rocketgenius for their sponsorship support and to Naomi C. Bush for her help in the initial add-on UI work.
WP-CLI Command for Syncing Entries
This add-on provides the ability to sync entries from a Form Submission and Entry Edit screen. To bulk sync all entries even prior to setting up a Pods Gravity Form Feed, you can run a WP-CLI command.
Example 1: Sync all entries for Form 123 first active Pod feed
wp pods-gf sync --form=123

Example 2: Sync all entries for Form 123 using a specific feed (even if it is inactive)
wp pods-gf sync --form=123 --feed=2

Mapping GF List Fields to a Pods Relationship field
You can map a GF List field to a Relationship field related to another Pod. Using the below examples you can customize how the automatic mapping works. By default, the list columns will map to the pod fields with the same labels.
Example 1: Customize what columns map to which Related Pod fields for Form ID 1, Field ID 2
Customizing a list field row can be done by using the pods_gf_field_columns_mapping filter, which has Form ID and Field ID variations (pods_gf_field_columns_mapping_{form_id} and pods_gf_field_columns_mapping_{form_id}_{field_id}).
add_filter( 'pods_gf_field_columns_mapping_1_2', 'my_columns_mapping', 10, 4 );

/**
* Filter list columns mapping for related pod fields.
*
* @param array $columns List field columns.
* @param array $form GF form.
* @param GF_Field $gf_field GF field data.
* @param Pods $pod Pods object.
*
* @return array
*/
function my_columns_mapping( $columns, $form, $gf_field, $related_obj ) {

$columns[0] = 'first_field';
$columns[1] = 'second_field';
$columns[2] = 'third_field';

return $columns;

}

Example 2: Customize a List row for Form ID 1, Field ID 2
Customizing a list field row can be done by using the pods_gf_field_column_row filter, which has Form ID and Field ID variations (pods_gf_field_column_row_{form_id} and pods_gf_field_column_row_{form_id}_{field_id}).
add_filter( 'pods_gf_field_column_row_1_2', 'my_column_row_override', 10, 6 );

/**
* Filter list field row for relationship field saving purposes.
*
* @param array $row List field row.
* @param array $columns List field columns.
* @param array $form GF form.
* @param GF_Field $gf_field GF field data.
* @param array $options Pods GF options.
* @param Pods|false $related_obj Related Pod object.
*
* @return array
*/
function my_column_row_override( $row, $columns, $form, $gf_field, $options, $related_obj ) {

// Update certain row fields based on the value of specific column.
if ( ! empty( $row['user_relationship_field'] ) ) {
$user = get_userdata( (int) $row['user'] );

// Set the post_title to match the User display name.
if ( $user && ! is_wp_error( $user ) ) {
$row['post_title'] = $user->display_name;
}
}

return $row;

}

延伸相關外掛

文章
Filter
Mastodon