public function hasErrors($name)
{
$session = $this->getSessionStore();
if (is_null($session) || !$session->has('errors')) {
// If the session is not set, or the session doesn't contain
// any errors, the form element does not have any errors
// applied to it.
return false;
}
// Get the errors from the session.
$errors = $session->get('errors');
// Check if the errors contain the form element with the given name.
return $errors->has($this->transformKey($name));
}