Skip to content

Commit

Permalink
Fix handling grouped options in issuer tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Jun 1, 2022
1 parent 0234c2a commit f586d5c
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/Tags/IssuerTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Pronamic\WordPress\Pay\Extensions\ContactForm7\Tags;

use Pronamic\WordPress\Pay\Extensions\ContactForm7\Pronamic;
use Pronamic\WordPress\Pay\Util;
use WPCF7_FormTag;
use WPCF7_Validation;

Expand Down Expand Up @@ -89,24 +90,11 @@ public function handler( $tag ) {
return '';
}

$options = array(
'<option></option>',
);

foreach ( $issuer_options[0]['options'] as $value => $label ) {
$options[] = sprintf(
'<option value="%1$s" %2$s>%3$s</option>',
\esc_attr( $value ),
\selected( $attributes['value'], $value, false ),
\esc_html( $label )
);
}

$html = \sprintf(
'<span class="wpcf7-form-control-wrap %1$s"><select %2$s>%3$s</select>%4$s</span>',
\sanitize_html_class( $tag->name ),
\wpcf7_format_atts( $attributes ),
\implode( '', $options ),
Util::select_options_grouped( $issuer_options, $attributes['value'] ),
$error
);

Expand Down

0 comments on commit f586d5c

Please sign in to comment.