aradianoff / recaptchacontact

reCaptcha Contact Plugin for Grav CMS (getgrav.org)
MIT License
8 stars 11 forks source link

Fixed a bug that was causing translations to be pulled in as an array #10

Closed bassplayer7 closed 7 years ago

bassplayer7 commented 8 years ago

The main change is at the very bottom where the parameter was causing the translate method to return an array. As a result, there was a consistent Exception being thrown for the array to string conversion. I'm not sure if this worked before but doesn't now due to a change in Grav core or what.

Basically it was returning an array like this:

$translation = array(
    [0] => "Error message"
    [1] => "Error message"
)
bassplayer7 commented 8 years ago

I found that I had duplicated the plugin folder (with a different name) and it was loading both language.yaml files together. With that, since, the last parameter was set to true, it loaded both together and passed them to Twig. It then took them both and threw an exception since it couldn't convert the array to a string.

The bottom line is that this is an extremely edge case and as such a low priority pull request. I looked through the Twig template, though, and couldn't see any reason for why the $array_support was set to true. With that, it probably wouldn't be a bad thing to merge this minor change in.

bassplayer7 commented 8 years ago

@aradianoff, do you think you will be able to merge these PRs at some point? If not, would you consider granting me write access?

aradianoff commented 7 years ago

I am sorry for the delay. I will grant you write access asap. :) I have been away for a long time.