OpenCart 🇺🇦

Схема

protected mixed validateForm ( )

Аргументы

Аргумент Возможный тип Описание
У метода нет аргументов

Описание

Метод пока еще не документирован.

Исходный код

if (!$this->user->hasPermission('modify', 'design/custom_field')) {
	$this->error['warning'] = $this->language->get('error_permission');
}

foreach ($this->request->post['custom_field_description'] as $language_id => $value) {
	if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 128)) {
		$this->error['name'][$language_id] = $this->language->get('error_name');
	}
}

if (($this->request->post['type'] == 'select' || $this->request->post['type'] == 'radio' || $this->request->post['type'] == 'checkbox') && !isset($this->request->post['custom_field_value'])) {
	$this->error['warning'] = $this->language->get('error_type');
}

if (isset($this->request->post['custom_field_value'])) {
	foreach ($this->request->post['custom_field_value'] as $custom_field_value_id => $custom_field_value) {
		foreach ($custom_field_value['custom_field_value_description'] as $language_id => $custom_field_value_description) {
			if ((utf8_strlen($custom_field_value_description['name']) < 1) || (utf8_strlen($custom_field_value_description['name']) > 128)) {
				$this->error['custom_field_value'][$custom_field_value_id][$language_id] = $this->language->get('error_custom_field_value'); 
			}					
		}
	}	
}

if (!$this->error) {
	return true;
} else {
	return false;
}