Skip to content

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

Open
cbichis wants to merge 12 commits into
bramstroker:masterfrom
cbichis:master
Open

Using messages from ZF validators + fix buildInlineJavascript for arrays, functions + added (commented for now additional-methods JS)#50
cbichis wants to merge 12 commits into
bramstroker:masterfrom
cbichis:master

Conversation

@cbichis

@cbichis cbichis commented May 28, 2017

Copy link
Copy Markdown

No description provided.

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
Copy Markdown
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()

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants