pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.06k stars 265 forks source link

Pods Conditional support "Base Fields" #7308

Open datgausaigon opened 2 weeks ago

datgausaigon commented 2 weeks ago

Problem to Solve

Hi, I have a feature request about Pods Conditional. From version 3.0 onwards Pods has supported Conditional. But it does not support comparing conditions with "Base Fields" of "Post". Example, I want show Custom Field "Foo" of WooCommerce Product when "product_type" is "simple". Can you add this feature? If possible with a hook, that's fine too.

Thanks ❤️

Proposed Solution

There is now a Conditional support hook for Pods, but it does not support "Base Fields"

/**
* Allow filtering the conditional logic object used for a Whatsit object.
*
* @since 3.0
*
* @param Conditional_Logic $conditional_logic The conditional logic object.
* @param Whatsit $object The object data.
* @param string $action The action to take (show/hide).
* @param string $logic The logic to use (any/all).
* @param array $rules The conditional rules.
*/
$conditional_logic = apply_filters( 'pods_data_conditional_logic_for_object', $conditional_logic, $object, $action, $logic,$rules );

Currently I have to use the old way which is using javascript/jquery to hide/show the metabox.

Possible Workaround

No response

Examples Elsewhere

No response

Screenshots / Screencast

No response