| @@ -84,8 +84,30 @@ | ||
| 84 | 84 | return static::$type; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | + * "This element is available in {brand} Pro" text for PRO-only elements' | |
| 89 | + * disabled_reason. Brand name follows the email currently being edited (set | |
| 90 | + * via the $yaymail_current_email_id global in | |
| 91 | + * yaymail_get_email_elements_data()) -- WordPress-platform emails use the | |
| 92 | + * 'wp-core-' id prefix. | |
| 93 | + * | |
| 94 | + * @return string | |
| 95 | + */ | |
| 96 | + public static function get_pro_upgrade_text() { | |
| 97 | + global $yaymail_current_email_id; | |
| 98 | + $is_wp_platform_email = ! empty( $yaymail_current_email_id ) | |
| 99 | + && ( 0 === strpos( $yaymail_current_email_id, 'wp-core-' ) || 0 === strpos( $yaymail_current_email_id, 'wp_' ) ); | |
| 100 | + $brand_name = $is_wp_platform_email ? 'Email Builder' : 'YayMail'; | |
| 101 | + | |
| 102 | + return sprintf( | |
| 103 | + // translators: %s: brand name (YayMail or Email Builder) | |
| 104 | + __( 'This element is available in %s Pro', 'yaymail' ), | |
| 105 | + $brand_name | |
| 106 | + ); | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 88 | 110 | * Converts an element's data to use default values. |
| 89 | 111 | * |
| 90 | 112 | * This function iterates through the 'data' array of an element, replacing each value with its 'default_value'. |
| 91 | 113 | * It then updates the element's 'data' with the formatted data and returns the modified element. |