Skip to content

Commit

Permalink
Merge pull request #2651 from woocommerce/PCP-3736-translations-no-lo…
Browse files Browse the repository at this point in the history
…nger-applied-to-card-fields-in-2-9-0

Add Custom Placeholder Handling when rendering the card fields (3736)
  • Loading branch information
Dinamiko authored Oct 4, 2024
2 parents b4b574d + 8b6cb86 commit 1325779
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions modules/ppcp-card-fields/resources/js/Render.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ function renderField( cardField, inputField ) {

// Insert the PayPal card field after the original input field.
const styles = cardFieldStyles( inputField );
cardField( { style: { input: styles } } ).render( inputField.parentNode );
const fieldOptions = {style: { input: styles },};

// Hide the original input field.
hide( inputField, true );
inputField.hidden = true;
if ( inputField.getAttribute( 'placeholder' ) ) {
fieldOptions.placeholder = inputField.getAttribute( 'placeholder' );
}

cardField( fieldOptions ).render( inputField.parentNode );

// Hide the original input field.
hide( inputField, true );
inputField.hidden = true;
}

export function renderFields( cardFields ) {
Expand Down

0 comments on commit 1325779

Please sign in to comment.