cgsmith / zf1-recaptcha-2

Zend Framework 1 integration for Google reCAPTCHA version 2.0
MIT License
9 stars 11 forks source link

allow custom classes in viewHelper #13

Closed solverat closed 8 years ago

solverat commented 8 years ago

it would be great if we could add some custom classes.

i added and tested the modified method in Cgsmith\View\Helper\FormReceptcha and it's working:

public function formRecaptcha($name, $value = null, $attribs = null, $options = null, $listsep = '')
{
    if (!isset($attribs['siteKey']) || !isset($attribs['secretKey'])) {
        throw new \Zend_Exception('Site key is not set in the view helper');
    }

    $customClasses = '';
    if( isset( $attribs['classes'] )) {
        if( is_array( $attribs['classes'] ) ) {
            $customClasses = implode(' ', $attribs['classes']);
        } else {
            $customClasses = $attribs['classes'];
        }
    }

    return '<div class="g-recaptcha ' . $customClasses . '" data-sitekey="' . $attribs['siteKey'] . '"></div>';
}
solverat commented 8 years ago

closed with https://github.com/cgsmith/zf1-recaptcha-2/pull/14.