Skip to content

Commit

Permalink
fix printing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ziodave committed Nov 29, 2023
1 parent 79e830e commit 1a6d9ce
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/admin/elements/class-wordlift-admin-input-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,42 +67,43 @@ public function render( $args ) {
$input_type = ! empty( $params['type'] ) ? $params['type'] : 'text';
?>

<input type="<?php echo esc_attr( $input_type ); ?>"
id="<?php echo esc_attr( $params['id'] ); ?>"
name="<?php echo esc_attr( $params['name'] ); ?>"
value="<?php echo esc_attr( $params['value'] ); ?>"
<input type="<?php echo esc_attr( $input_type ); ?>"
id="<?php echo esc_attr( $params['id'] ); ?>"
name="<?php echo esc_attr( $params['name'] ); ?>"
value="<?php echo esc_attr( $params['value'] ); ?>"
<?php
if ( $params['pattern'] ) {
echo ' pattern="';
echo esc_attr( $params['pattern'] );
echo '"';
}
?>
<?php

if ( $params['placeholder'] ) {
echo ' placeholder="';
echo esc_attr( $params['placeholder'] );
echo '"';
}
?>
<?php

if ( ! empty( $params['data'] ) && is_array( $params['data'] ) ) {
foreach ( $params['data'] as $key => $value ) {
echo 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" ';
}
}

if ( ! empty( $params['readonly'] ) ) {
?>
readonly="readonly" <?php } ?>
<?php
echo ' readonly="readonly"';
}

if ( ! empty( $params['css_class'] ) ) {
?>
class="<?php echo esc_attr( $params['css_class'] ); ?>" <?php } ?>
/>
echo ' class="';
echo esc_attr( $params['css_class'] );
echo '"';
} ?>
/>
<?php
if ( ! empty( $params['description'] ) ) {
?>
<p><?php echo wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ); ?></p><?php } ?>
<p><?php echo wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ); ?></p><?php } ?>

<?php

Expand Down

0 comments on commit 1a6d9ce

Please sign in to comment.