Get form element errors for a field.

@param  string $name
@return array
507200
public function getErrors($name)
    {
        $field  = $this->getField($name);
        $errors = (null !== $field) ? $field->getErrors() : [];
        return $errors;
    }
1296188
public function getSettingError(string $name): array
    {
        $errors = get_settings_errors($this->getSlug());

        if (empty($errors)) {
            return [];
        }

        return collect($errors)->first(function ($error) use ($name) {
            return $error['code'] === $name;
        });
    }
820163
private function getValue($form, $name)
    {
        if (is_array($form)) {
            return isset($form[$name]) ? $form[$name] : null;
        } elseif (is_object($form)) {
            $method = 'get' . $name;
            if (method_exists($form, $method)) {
                return $form->$method();
            } else {
                return isset($form->$name) ? $form->$name : null;
            }
        }
    }
1021843
static function laraform($name) {
        $el = new ElementSwitchTwbs($name);
        $el->addClass('js-bootstrap-switch')
            ->setOffClass('danger')
            ->setOffLabel('Нет')
            ->setOnClass('success')
            ->setOnLabel('Да')
            ->setSizeSmall();

        return $el;
    }
930978
public function getValidationErrors()
    {
        return [
            /** Bundle option related errors */
            __('The options you selected are not available.')->render(),
            __('The required options you selected are not available.')->render(),
            __('Please specify product option(s).')->render(),
            __('Please select all required options.')->render(),
            __('You need to choose options for your item.')->render(),

            /** Input field related errors */
            __('The text is too long.')->render(),
            __('Please specify product\'s required option(s).')
        ];
    }
962498
private function getOldAttribute($name)
    {
        if ($this->hasOldAttribute($name)) {
            $collection = $this->getOldAttributes();
            return $collection[$name];
        } else {
            // Error
        }
    }
1267304
public function getField($name)
    {
        return (isset($this->fields[$name])) ? $this->fields[$name] : false;
    }
596317
private function getFieldsWithName($name)
    {
        $trigFields = array();
        $fields = &$this->form->currentFields;
        if (isset($fields[$name])) {
            $trigFields[] = $fields[$name];
        } else {
            foreach ($fields as $f) {
                if ($f->attribs['name'] == $name) {
                    $trigFields[] = $f;
                }
            }
        }
        return $trigFields;
    }
554236
public function getFormElementDefinition($name)
    {
        if (array_key_exists($name, $this->namedFields)) {
            return $this->namedFields[$name];
        }

        throw new CMDLParserException('Could not find a formelement named ' . $name,
            CMDLParserException::CMDL_FORMELEMENT_NOT_FOUND);
    }
1117560
public function get($name)
    {
        if ($this->has($name)) {
            $code = $this->getCode($name);

            $this->elements[$code] = $this->resolve($this->elements[$code]);

            return $this->elements[$code];
        }

        throw new \InvalidArgumentException(sprintf('Element "%s" does not exist.', $name));
    }
325394
public function getFieldErrors($field) {
		$existing = array_key_get($this->errors['fields'], $field['options']['name']);
		if (!empty($existing)) {
			$result = [
				'type' => null,
				'message' => '',
				'counters' => []
			];
			$sorted = [
				'danger' => [],
				'warning' => [],
				'success' => [],
				'info' => []
			];
			$types = array_keys($existing);
			if (in_array('danger', $types)) {
				$result['type'] = 'danger';
			} else {
				$temp = current($types);
				$result['type'] = $temp;
			}
			// generating text messages
			foreach ($existing as $k => $v) {
				foreach ($v as $k2 => $v2) {
					$result['counters'][$k] = ($result[$k] ?? 0) + 1;
					$sorted[$k][$k2] = $v2;
				}
			}
			foreach ($sorted as $k => $v) {
				if (empty($v)) continue;
				foreach ($v as $k2 => $v2) {
					$result['message'].= \HTML::text(['tag' => 'div', 'class' => 'numbers_field_error_messages', 'data-field_value_hash' => $k2, 'type' => $k, 'value' => $v2]);
				}
			}
			return $result;
		}
		return null;
	}
256027
public function getErrors(bool $allow_multiple_errors = false) : array
    {
        if (false === $this->validated) $this->validate();
        $returned_errors = array();
        $field_names = array();

        if ($allow_multiple_errors) {
            $returned_errors = $this->validation_errors;
        } else {
            foreach ($this->validation_errors as $error) {
                if (!in_array($error->getFieldName(), $field_names)) {
                    array_push($returned_errors, $error);
                    array_push($field_names, $error->getFieldName());
                }
            }
        }
        return $returned_errors;
    }
1119784
public function getEvent(string $name): array
    {
        return isset($this->events[$name]) ? $this->events[$name] : [];
    }
758839
protected function getFormValue($name)
    {
        $this->setFormValues();
        return isset($this->formValues[$name]) ? $this->formValues[$name] : '';
    }
1249492
public static function element($name) {
        if (isset(static::$html5[$name])) {
            return static::$html5[$name];
        }
        if (isset(static::$svg[$name])) {
            return static::$svg[$name];
        }
        if (isset(static::$mathml[$name])) {
            return static::$mathml[$name];
        }

        return false;
    }
883706
public function getValidator($name)
    {
        if (!isset($this->validators[$name])) {
            $rules = $this->getRules();
            if (!isset($rules[$name])) {
                throw new InvalidArgumentException('Can not find rule with name: ' . $name);
            } else {
                $options = $rules[$name];
                $options['elements'] = $options[0];
                $options['type'] = $options[1];
                unset($options[0], $options[1]);
                $this->setValidator($name, $options);
            }
        }

        return $this->validators[$name];
    }
13686
public function GetElement($name)
    {
        $element = $this->Elements()->GetElement($name);
        if (!$element)
        {
            throw new \Exception(Trans('Core.Form.Error.ElementNotFound.Name_{0}', $name));
        }
        return $element;
    }