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

Using messages from ZF validators + fix buildInlineJavascript for arrays, functions + added (commented for now additional-methods JS) #50

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

cbichis
Copy link

@cbichis cbichis commented May 28, 2017

No description provided.

@@ -30,8 +30,7 @@ public function getRules(ValidatorInterface $validator, ElementInterface $elemen
public function getMessages(ValidatorInterface $validator)
{
return [
'range' =>
sprintf($this->translateMessage('The input is not between %s and %s'), $this->getMin($validator), $this->getMax($validator))
'range' => sprintf($validator->getMessageTemplates()[\Zend\Validator\Between::NOT_BETWEEN], $this->getMin($validator), $this->getMax($validator))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message need to be passed through the translator. You can use the same method as before $this->translateMessage()

@@ -86,6 +86,7 @@ public function preRenderForm($formAlias, View $view, FormInterface $form = null
if ($options->getIncludeAssets()) {
$assetBaseUri = $this->getHttpRouter()->assemble([], ['name' => 'strokerform-asset']);
$inlineScript->appendFile($assetBaseUri . '/jquery_validate/js/jquery.validate.js');
//$inlineScript->appendFile($assetBaseUri . '/jquery_validate/js/additional-methods.min.js');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include the asset and don't remove this line

$value = (is_string($value)) ? $value : var_export($value, true);

if(is_string($value)){
if(strpos($value, 'function') === 0){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a unit test for this case please? Than we can also see if we can improve this code a little because it is a littlebit messy now with all these if / else statements.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not very familiar with unit tests unfortunatelly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants