"Filter: bricks/conditions/result"
نتیجه بولی بررسی شرایط را فیلتر میکند. این فیلتر برای پیاده سازی منطق برای شرایط سفارشی یا نادیده گرفتن منطق شرایط موجود استفاده میشود.
پارامترها
$result(bool): The result of the condition evaluation.$condition_key(string): The key of the condition being evaluated (e.g.,user_role,my_custom_condition).$condition(array): The condition settings (containscompare,value, etc.).
نمونه استفاده
add_filter( 'bricks/conditions/result', function( $result, $condition_key, $condition ) {
// Logic for custom 'is_weekend' condition
if ( $condition_key === 'is_weekend' ) {
$is_weekend = ( date( 'N' ) >= 6 );
$value = isset( $condition['value'] ) ? $condition['value'] : 'true';
// Check if condition value matches current state
if ( $value === 'true' ) {
return $is_weekend;
} else {
return ! $is_weekend;
}
}
return $result;
}, 10, 3 );