| @@ -1547,8 +1547,9 @@ | ||
| 1547 | 1547 | * @param array $args a. only_level = If set to true will only return the level name if multi-level |
| 1548 | 1548 | * enabled. b. separator = The separator between the Form Title and the Donation |
| 1549 | 1549 | * Level. |
| 1550 | 1550 | * |
| 1551 | + * @since 4.16.5 lookup option values by level ID (price_id) first before falling back to amount-based matching | |
| 1551 | 1552 | * @since 4.14.5 add currency compatibility to determine whether the level is same as donation amount |
| 1552 | 1553 | * @since 3.18.0 check if donation form is V3 form |
| 1553 | 1554 | * @since 1.5 |
| 1554 | 1555 | * |
| @@ -1579,8 +1580,18 @@ | ||
| 1579 | 1580 | $default_currency = give_get_option('currency'); // default currency |
| 1580 | 1581 | $payment_currency = give_get_payment_currency_code($donation_id); // donation currency |
| 1581 | 1582 | $options = give()->form_meta->get_meta($form_id, '_give_donation_levels', true) ?? []; |
| 1582 | 1583 | $donation = Donation::find($donation_id); |
| 1584 | + $price_id = give_get_meta( $donation_id, '_give_payment_price_id', true ); | |
| 1585 | + | |
| 1586 | + if ( $price_id !== '' && $price_id !== 'custom' && ! is_null( $price_id ) ) { | |
| 1587 | + foreach ( $options as $option ) { | |
| 1588 | + if ( isset( $option['_give_id']['level_id'] ) && (string) $option['_give_id']['level_id'] === (string) $price_id ) { | |
| 1589 | + $form_title = sprintf('%s %s %s', $form_title, $args['separator'], $option['_give_text']); | |
| 1590 | + return apply_filters('give_get_donation_form_title', $form_title, $donation_id); | |
| 1591 | + } | |
| 1592 | + } | |
| 1593 | + } | |
| 1583 | 1594 | |
| 1584 | 1595 | // Different currencies - use exchange rate from currency switcher |
| 1585 | 1596 | $exchange_rate = give_get_meta($donation_id, '_give_cs_exchange_rate', true); |
| 1586 | 1597 | |