isValidSize($value) && $isValid; } protected function isValidSize($value) { if (count($value) > 10) { $this->addError('You can not choose more than 10 Vendor Classifications'); return false; } return true; } /** * Native method is overridden to avoid wrong behaviour when error messages is multiplied for each value * @return array */ protected function _getErrorMessages() { $translator = $this->getTranslator(); $messages = $this->getErrorMessages(); $value = $this->getValue(); foreach ($messages as $key => $message) { if (null !== $translator) { $message = $translator->translate($message); } $messages[$key] = str_replace('%value%', $value, $message); } return $messages; } }