/** * Get the field input. * * @see https://github.com/wp-premium/gravityforms/blob/2.0.3/includes/fields/class-gf-field-select.php#L41-L60 * @see https://github.com/wp-premium/gravityforms/blob/2.0.3/includes/fields/class-gf-field.php#L182-L193 * @param array $form * @param string $value * @param array $entry * @return string */ public function get_field_input($form, $value = '', $entry = null) { // Error handling if (is_wp_error($this->error)) { return $this->error->get_error_message(); } // Input $input = parent::get_field_input($form, $value, $entry); if (is_admin()) { $feeds = get_pronamic_gf_pay_feeds_by_form_id($form['id']); $new_feed_url = add_query_arg('post_type', 'pronamic_pay_gf', admin_url('post-new.php')); if (empty($feeds)) { $link = sprintf('<a class="ideal-edit-link" href="%s" target="_blank">%s</a>', esc_attr($new_feed_url), __('New Payment Feed', 'pronamic_ideal')); $input = $link . $input; } if (!empty($feeds) && empty($this->choices)) { // If there are feeds and no choices it's very likely this field is no supported by the gateway. $error = sprintf('<p class="pronamic-pay-error"><strong>%s</strong><br><em>%s</em></p>', __('This field is not supported by your payment gateway.', 'pronamic_ideal'), sprintf(__('Please remove it from this form or <a href="%s" target="_blank">add a supported payment gateway</a>.', 'pronamic_ideal'), esc_attr($new_feed_url))); $input = $error . $input; } } return $input; }
/** * Get the field input. * * @see https://github.com/wp-premium/gravityforms/blob/2.0.3/includes/fields/class-gf-field-select.php#L41-L60 * @see https://github.com/wp-premium/gravityforms/blob/2.0.3/includes/fields/class-gf-field.php#L182-L193 * @param array $form * @param string $value * @param array $entry * @return string */ public function get_field_input($form, $value = '', $entry = null) { // Error handling if (is_wp_error($this->error)) { return $this->error->get_error_message(); } // Input $input = parent::get_field_input($form, $value, $entry); if (is_admin()) { $feeds = get_pronamic_gf_pay_feeds_by_form_id($form['id']); if (empty($feeds)) { $link = sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", add_query_arg('post_type', 'pronamic_pay_gf', admin_url('post-new.php')), __('Create pay feed', 'pronamic_ideal')); $input = $link . $input; } } return $input; }