Skip to content
Snippets Groups Projects
Commit 9b03b624 authored by Demian Katz's avatar Demian Katz
Browse files

Refactored to reduce complexity of subclass.

parent ff8876bd
No related merge requests found
......@@ -4,7 +4,7 @@
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
* Copyright (C) Villanova University 2016.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
......@@ -39,21 +39,16 @@ namespace VuFind\View\Helper\Bootstrap3;
class Recaptcha extends \VuFind\View\Helper\Root\Recaptcha
{
/**
* Wrap in bootstrap 3-9 columns. Generate <div> with ReCaptcha from render.
* Constructor
*
* @param boolean $useRecaptcha Boolean of active state, for compact templating
*
* @return string $html
* @param \ZendService\Recaptcha\Recaptcha $rc Custom formatted Recaptcha
* @param \VuFind\Config $config Config object
*/
public function html($useRecaptcha = true)
public function __construct($rc, $config)
{
if (!isset($useRecaptcha) || !$useRecaptcha) {
return false;
}
return '<div class="form-group">' .
'<div class="col-sm-9 col-sm-offset-3">' .
$this->recaptcha->getHtml() .
'</div>' .
'</div>';
$this->prefixHtml = '<div class="form-group">' .
'<div class="col-sm-9 col-sm-offset-3">';
$this->suffixHtml = '</div></div>';
parent::__construct($rc, $config);
}
}
......@@ -53,6 +53,20 @@ class Recaptcha extends AbstractHelper
*/
protected $active;
/**
* HTML prefix for ReCaptcha output.
*
* @var string
*/
protected $prefixHtml = '';
/**
* HTML suffix for ReCaptcha output.
*
* @var string
*/
protected $suffixHtml = '';
/**
* Constructor
*
......@@ -87,7 +101,7 @@ class Recaptcha extends AbstractHelper
if (!isset($useRecaptcha) || !$useRecaptcha) {
return false;
}
return $this->recaptcha->getHtml();
return $this->prefixHtml . $this->recaptcha->getHtml() . $this->suffixHtml;
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment