Give_Donate_Form::is_single_price_mode PHP Method

is_single_price_mode() public method

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

Usage Example

Exemplo n.º 1
0
 /**
  * Test Get Prices
  *
  * @covers Give_Donate_Form::get_prices
  */
 public function test_get_prices()
 {
     $multi_form = new Give_Donate_Form($this->_multi_form->ID);
     $this->assertTrue($multi_form->has_variable_prices());
     $this->assertFalse($multi_form->is_single_price_mode());
     $prices = $multi_form->get_prices();
     $this->assertEquals(4, count($prices));
 }