id = $array['_give_id']['level_id']; $self->amount = Money::fromDecimal($array['_give_amount'], give_get_currency()); $self->label = $array['_give_text'] ?? ''; $self->isDefault = isset($array['_give_default']) && $array['_give_default'] === 'default'; return $self; } /** * @since 2.24.0 * * @param string $price * * @return DonationFormLevel */ public static function fromPrice(string $price): DonationFormLevel { $self = new static(); $self->id = 0; $self->amount = Money::fromDecimal($price, give_get_currency()); $self->label = ''; $self->isDefault = true; return $self; } }