Skip to content

Commit

Permalink
Refactor color input render code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecRust committed Jul 27, 2023
1 parent d4862c3 commit 2e8c87d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function render_settings_page()
{
?>
<div class="wrap">
<h2><?php _e('Protected Video', 'protected-video'); ?></h2>
<h2><?= __('Protected Video', 'protected-video') ?></h2>
<form method="post" action="options.php">
<?php
settings_fields('protected_video_option_group');
Expand Down Expand Up @@ -180,13 +180,12 @@ public function render_color_input($val)
$id = $val['id'];
$name = $val['option_name'];
$value = get_option($name, '#00b3ff');
?>
<input
type="color"
id="<?php echo esc_attr($id); ?>"
name="<?php echo esc_attr($name); ?>"
value="<?php echo esc_attr($value); ?>"
>
<?php

printf(
'<input type="color" id="%s" name="%s" value="%s">',
esc_attr($id),
esc_attr($name),
esc_attr($value)
);
}
}

0 comments on commit 2e8c87d

Please sign in to comment.