mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
PCP-26 / introduce text field with autocomplete off
This commit is contained in:
parent
585d5350ff
commit
754913b632
3 changed files with 31 additions and 3 deletions
|
@ -193,7 +193,7 @@ return [
|
||||||
],
|
],
|
||||||
'client_id' => [
|
'client_id' => [
|
||||||
'title' => __('Client Id', 'woocommerce-paypal-commerce-gateway'),
|
'title' => __('Client Id', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'type' => 'text',
|
'type' => 'ppcp-text-input',
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'description' => __('The client id of your api ', 'woocommerce-paypal-commerce-gateway'),
|
'description' => __('The client id of your api ', 'woocommerce-paypal-commerce-gateway'),
|
||||||
'default' => false,
|
'default' => false,
|
||||||
|
|
|
@ -81,6 +81,29 @@ class SettingsRenderer
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function renderTextInput($field, $key, $config, $value): string
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($config['type'] !== 'ppcp-text-input') {
|
||||||
|
return $field;
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = sprintf(
|
||||||
|
'<input
|
||||||
|
type="text"
|
||||||
|
autocomplete="off"
|
||||||
|
class="%s"
|
||||||
|
name="%s"
|
||||||
|
value="%s"
|
||||||
|
>',
|
||||||
|
esc_attr(implode(' ', $config['class'])),
|
||||||
|
esc_attr($key),
|
||||||
|
esc_attr($value)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
//phpcs:enable Inpsyde.CodeQuality.ArgumentTypeDeclaration.NoArgumentType
|
//phpcs:enable Inpsyde.CodeQuality.ArgumentTypeDeclaration.NoArgumentType
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
|
|
@ -118,8 +118,13 @@ class WcGatewayModule implements ModuleInterface
|
||||||
* @var SettingsRenderer $renderer
|
* @var SettingsRenderer $renderer
|
||||||
*/
|
*/
|
||||||
return $renderer->renderPassword(
|
return $renderer->renderPassword(
|
||||||
$renderer->renderMultiSelect(
|
$renderer->renderTextInput(
|
||||||
$field,
|
$renderer->renderMultiSelect(
|
||||||
|
$field,
|
||||||
|
$key,
|
||||||
|
$args,
|
||||||
|
$value
|
||||||
|
),
|
||||||
$key,
|
$key,
|
||||||
$args,
|
$args,
|
||||||
$value
|
$value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue