Give_Donate_Form::is_custom_price_mode PHP Method

is_custom_price_mode() public method

Determine if custom price mode is enabled or disabled
Since: 1.6
public is_custom_price_mode ( ) : boolean
return boolean
    public function is_custom_price_mode()
    {
        $option = get_post_meta($this->ID, '_give_custom_amount', true);
        $ret = 0;
        if ($option === 'yes') {
            $ret = 1;
        }
        /**
         * Override the price mode for a donation when checking if is in custom price mode.
         *
         * @since 1.6
         *
         * @param bool $ret Is donation form in custom price mode?
         * @param int|string The ID of the donation form.
         */
        return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
    }

Usage Example

Beispiel #1
0
/**
 * Determine if custom price mode is enabled or disabled
 * This function is wrapper function to Give_Donate_Form::is_custom_price_mode()
 *
 * @since 1.6
 * 
 * @param int $form_id Form ID.
 *
 * @use Give_Donate_Form::is_custom_price_mode()
 * 
 * @return bool
 */
function give_is_custom_price_mode($form_id = 0)
{
    if (empty($form_id)) {
        return false;
    }
    $form = new Give_Donate_Form($form_id);
    return $form->is_custom_price_mode();
}