OpenCart 🇺🇦

Схема

protected mixed validateForm ( )

Аргументы

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

Описание

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

Исходный код

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

foreach ($this->request->post['option_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['option_value'])) {
	$this->error['warning'] = $this->language->get('error_type');
}

if (isset($this->request->post['option_value'])) {
	foreach ($this->request->post['option_value'] as $option_value_id => $option_value) {
		foreach ($option_value['option_value_description'] as $language_id => $option_value_description) {
			if ((utf8_strlen($option_value_description['name']) < 1) || (utf8_strlen($option_value_description['name']) > 128)) {
				$this->error['option_value'][$option_value_id][$language_id] = $this->language->get('error_option_value'); 
			}					
		}
	}	
}

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