← All changes
|
includes/admin/shortcodes/shortcode-give-goal.php
+40
-27
2.3.2
→
4.16.9
View file →
| @@ -30,8 +30,10 @@ | ||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Define the shortcode attribute fields |
| 34 | + * | |
| 35 | + * @since 4.0.0 Replace "new form" with "new campaign form" link | |
| 34 | 36 | * |
| 35 | 37 | * @return array |
| 36 | 38 | */ |
| 37 | 39 | public function define_fields() { |
| @@ -36,54 +38,65 @@ | ||
| 36 | 38 | */ |
| 37 | 39 | public function define_fields() { |
| 38 | 40 | |
| 39 | 41 | $create_form_link = sprintf( |
| 40 | - /* translators: %s: create new form URL */ | |
| 41 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), | |
| 42 | - admin_url( 'post-new.php?post_type=give_forms' ) | |
| 42 | + /* translators: %s: create new form URL */ | |
| 43 | + __('<a href="%s">Create</a> a new Campaign Form.', 'give'), | |
| 44 | + admin_url('edit.php?post_type=give_forms&page=give-campaigns&new=campaign') | |
| 43 | 45 | ); |
| 44 | 46 | |
| 45 | - return array( | |
| 46 | - array( | |
| 47 | + return [ | |
| 48 | + [ | |
| 47 | 49 | 'type' => 'post', |
| 48 | - 'query_args' => array( | |
| 50 | + 'query_args' => [ | |
| 49 | 51 | 'post_type' => 'give_forms', |
| 50 | 52 | 'meta_key' => '_give_goal_option', |
| 51 | 53 | 'meta_value' => 'enabled', |
| 52 | - ), | |
| 54 | + ], | |
| 53 | 55 | 'name' => 'id', |
| 54 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), | |
| 55 | - 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', | |
| 56 | - 'required' => array( | |
| 57 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), | |
| 58 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ), | |
| 59 | - ), | |
| 60 | - ), | |
| 61 | - array( | |
| 56 | + 'tooltip' => esc_attr__('Select a Campaign Form', 'give'), | |
| 57 | + 'placeholder' => '- ' . esc_attr__('Select a Campaign Form', 'give') . ' -', | |
| 58 | + 'required' => [ | |
| 59 | + 'alert' => esc_html__('You must first select a Campaign Form!', 'give'), | |
| 60 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', | |
| 61 | + esc_html__('No campaign forms found.', 'give'), $create_form_link), | |
| 62 | + ], | |
| 63 | + ], | |
| 64 | + [ | |
| 62 | 65 | 'type' => 'container', |
| 63 | 66 | 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
| 64 | - ), | |
| 65 | - array( | |
| 67 | + ], | |
| 68 | + [ | |
| 66 | 69 | 'type' => 'listbox', |
| 67 | 70 | 'name' => 'show_text', |
| 68 | 71 | 'label' => esc_attr__( 'Show Text:', 'give' ), |
| 69 | - 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ), | |
| 70 | - 'options' => array( | |
| 72 | + 'tooltip' => esc_attr__( 'This text displays the amount of revenue raised compared to the goal.', 'give' ), | |
| 73 | + 'options' => [ | |
| 71 | 74 | 'true' => esc_html__( 'Show', 'give' ), |
| 72 | 75 | 'false' => esc_html__( 'Hide', 'give' ), |
| 73 | - ), | |
| 74 | - ), | |
| 75 | - array( | |
| 76 | + ], | |
| 77 | + ], | |
| 78 | + [ | |
| 76 | 79 | 'type' => 'listbox', |
| 77 | 80 | 'name' => 'show_bar', |
| 78 | 81 | 'label' => esc_attr__( 'Show Progress Bar:', 'give' ), |
| 79 | 82 | 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
| 80 | - 'options' => array( | |
| 83 | + 'options' => [ | |
| 81 | 84 | 'true' => esc_html__( 'Show', 'give' ), |
| 82 | 85 | 'false' => esc_html__( 'Hide', 'give' ), |
| 83 | - ), | |
| 84 | - ), | |
| 85 | - ); | |
| 86 | + ], | |
| 87 | + ], | |
| 88 | + [ | |
| 89 | + 'type' => 'docs_link', | |
| 90 | + 'text' => esc_html__( 'Learn more about the Goal Shortcode', 'give' ), | |
| 91 | + 'link' => 'http://docs.givewp.com/shortcode-give-goal', | |
| 92 | + ], | |
| 93 | + ]; | |
| 86 | 94 | } |
| 87 | 95 | } |
| 88 | 96 | |
| 89 | -new Give_Shortcode_Donation_Form_Goal; | |
| 97 | +/** | |
| 98 | + * @since 4.3.0 use init action | |
| 99 | + */ | |
| 100 | +add_action( 'init', static function () { | |
| 101 | + new Give_Shortcode_Donation_Form_Goal(); | |
| 102 | +}); | |