mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-09 00:55:23 +02:00
[ticket/11201] Move type specific error messages to type class
PHPBB3-11201
This commit is contained in:
parent
5e2ffe0d5c
commit
ae38cfaa70
@ -623,15 +623,7 @@ class acp_profile
|
|||||||
$error[] = $user->lang['EMPTY_USER_FIELD_NAME'];
|
$error[] = $user->lang['EMPTY_USER_FIELD_NAME'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($field_type == FIELD_DROPDOWN && !sizeof($cp->vars['lang_options']))
|
$error = $profile_field->validate_options_on_submit($error, $cp->vars);
|
||||||
{
|
|
||||||
$error[] = $user->lang['NO_FIELD_ENTRIES'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($field_type == FIELD_BOOL && (empty($cp->vars['lang_options'][0]) || empty($cp->vars['lang_options'][1])))
|
|
||||||
{
|
|
||||||
$error[] = $user->lang['NO_FIELD_ENTRIES'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for already existing field ident
|
// Check for already existing field ident
|
||||||
if ($action != 'edit')
|
if ($action != 'edit')
|
||||||
|
@ -49,4 +49,12 @@ abstract class type_base implements type_interface
|
|||||||
{
|
{
|
||||||
return $this->request->variable('lang_options', '', true);
|
return $this->request->variable('lang_options', '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function validate_options_on_submit($error, $field_data)
|
||||||
|
{
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,4 +239,17 @@ class type_bool extends type_base
|
|||||||
|
|
||||||
return $this->request->variable('lang_options', array(''), true);
|
return $this->request->variable('lang_options', array(''), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function validate_options_on_submit($error, $field_data)
|
||||||
|
{
|
||||||
|
if (empty($field_data['lang_options'][0]) || empty($field_data['lang_options'][1]))
|
||||||
|
{
|
||||||
|
$error[] = $this->user->lang['NO_FIELD_ENTRIES'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,4 +211,17 @@ class type_dropdown extends type_base
|
|||||||
|
|
||||||
return $this->request->variable('lang_options', '', true);
|
return $this->request->variable('lang_options', '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function validate_options_on_submit($error, $field_data)
|
||||||
|
{
|
||||||
|
if (!sizeof($field_data['lang_options']))
|
||||||
|
{
|
||||||
|
$error[] = $this->user->lang['NO_FIELD_ENTRIES'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,4 +122,13 @@ interface type_interface
|
|||||||
* @return mixed Returns the provided language options
|
* @return mixed Returns the provided language options
|
||||||
*/
|
*/
|
||||||
public function prepare_options_form(&$exclude_options, &$visibility_options);
|
public function prepare_options_form(&$exclude_options, &$visibility_options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows exclusion of options in single steps of the creation process
|
||||||
|
*
|
||||||
|
* @param array $error Array with error messages
|
||||||
|
* @param array $field_data Array with data for this field
|
||||||
|
* @return array Array with error messages
|
||||||
|
*/
|
||||||
|
public function validate_options_on_submit($error, $field_data);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user