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 @@ ...@@ -4,7 +4,7 @@
* *
* PHP version 5 * 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 * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, * it under the terms of the GNU General Public License version 2,
...@@ -39,21 +39,16 @@ namespace VuFind\View\Helper\Bootstrap3; ...@@ -39,21 +39,16 @@ namespace VuFind\View\Helper\Bootstrap3;
class Recaptcha extends \VuFind\View\Helper\Root\Recaptcha 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 * @param \ZendService\Recaptcha\Recaptcha $rc Custom formatted Recaptcha
* * @param \VuFind\Config $config Config object
* @return string $html
*/ */
public function html($useRecaptcha = true) public function __construct($rc, $config)
{ {
if (!isset($useRecaptcha) || !$useRecaptcha) { $this->prefixHtml = '<div class="form-group">' .
return false; '<div class="col-sm-9 col-sm-offset-3">';
} $this->suffixHtml = '</div></div>';
return '<div class="form-group">' . parent::__construct($rc, $config);
'<div class="col-sm-9 col-sm-offset-3">' .
$this->recaptcha->getHtml() .
'</div>' .
'</div>';
} }
} }
...@@ -53,6 +53,20 @@ class Recaptcha extends AbstractHelper ...@@ -53,6 +53,20 @@ class Recaptcha extends AbstractHelper
*/ */
protected $active; protected $active;
/**
* HTML prefix for ReCaptcha output.
*
* @var string
*/
protected $prefixHtml = '';
/**
* HTML suffix for ReCaptcha output.
*
* @var string
*/
protected $suffixHtml = '';
/** /**
* Constructor * Constructor
* *
...@@ -87,7 +101,7 @@ class Recaptcha extends AbstractHelper ...@@ -87,7 +101,7 @@ class Recaptcha extends AbstractHelper
if (!isset($useRecaptcha) || !$useRecaptcha) { if (!isset($useRecaptcha) || !$useRecaptcha) {
return false; 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