Give_Donate_Form::__get PHP Method

__get() public method

Magic __get function to dispatch a call to retrieve a private property
Since: 1.0
public __get ( string $key ) : mixed
$key string
return mixed
    public function __get($key)
    {
        if (method_exists($this, 'get_' . $key)) {
            return call_user_func(array($this, 'get_' . $key));
        } else {
            /* translators: %s: property key */
            return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
        }
    }

Usage Example

Exemplo n.º 1
0
/**
 * Returns the minimum price amount of a form, only enforced for the custom amount input.
 *
 * @since 1.3.6
 *
 * @param int $form_id ID number of the form to retrieve the minimum price for
 *
 * @return mixed string|int Minimum price of the form
 */
function give_get_form_minimum_price($form_id = 0)
{
    if (empty($form_id)) {
        return false;
    }
    $form = new Give_Donate_Form($form_id);
    return $form->__get('minimum_price');
}