Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide in bootstrap4 #3197

Merged
merged 10 commits into from
Jul 11, 2020
Merged
8 changes: 8 additions & 0 deletions app/Config/Honeypot.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ class Honeypot extends BaseConfig
* @var boolean
*/
public $hidden = true;

/**
* Div wrapper of honeypot.
*
* @var string
*/
public $container = '<div style="display:none">%s</div>';

/**
* Honeypot Label Content
*
Expand Down
7 changes: 6 additions & 1 deletion system/Honeypot/Honeypot.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ function __construct(BaseConfig $config)
{
throw HoneypotException::forNoHiddenValue();
}

if (empty($this->config->container) || strpos($this->config->container, '%s') === false)
{
$this->config->container = '<div style="display:none">%s</div>';
}

if ($this->config->template === '')
{
Expand Down Expand Up @@ -124,7 +129,7 @@ protected function prepareTemplate(string $template): string

if ($this->config->hidden)
{
$template = '<div style="display:none">' . $template . '</div>';
$template = sprintf($this->config->container, $template);
}
return $template;
}
Expand Down