mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-09 10:16:36 +02:00
[ticket/11201] Move language option determination into type class
PHPBB3-11201
This commit is contained in:
@@ -193,4 +193,22 @@ class type_bool implements type_interface
|
||||
{
|
||||
return 'TINT:2';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_language_options($field_data)
|
||||
{
|
||||
$options = array(
|
||||
'lang_name' => 'string',
|
||||
'lang_options' => 'two_options',
|
||||
);
|
||||
|
||||
if ($field_data['lang_explain'])
|
||||
{
|
||||
$options['lang_explain'] = 'text';
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
@@ -240,4 +240,21 @@ class type_date implements type_interface
|
||||
{
|
||||
return 'VCHAR:10';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_language_options($field_data)
|
||||
{
|
||||
$options = array(
|
||||
'lang_name' => 'string',
|
||||
);
|
||||
|
||||
if ($field_data['lang_explain'])
|
||||
{
|
||||
$options['lang_explain'] = 'text';
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
@@ -191,4 +191,22 @@ class type_dropdown implements type_interface
|
||||
{
|
||||
return 'UINT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_language_options($field_data)
|
||||
{
|
||||
$options = array(
|
||||
'lang_name' => 'string',
|
||||
'lang_options' => 'optionfield',
|
||||
);
|
||||
|
||||
if ($field_data['lang_explain'])
|
||||
{
|
||||
$options['lang_explain'] = 'text';
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
@@ -166,4 +166,21 @@ class type_int implements type_interface
|
||||
{
|
||||
return 'BINT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_language_options($field_data)
|
||||
{
|
||||
$options = array(
|
||||
'lang_name' => 'string',
|
||||
);
|
||||
|
||||
if ($field_data['lang_explain'])
|
||||
{
|
||||
$options['lang_explain'] = 'text';
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
@@ -97,4 +97,12 @@ interface type_interface
|
||||
* @return string Returns the database column type
|
||||
*/
|
||||
public function get_database_column_type();
|
||||
|
||||
/**
|
||||
* Get the options we need to display for the language input fields in the ACP
|
||||
*
|
||||
* @param array $field_data Array with data for this field
|
||||
* @return array Returns the language options we need to generate
|
||||
*/
|
||||
public function get_language_options($field_data);
|
||||
}
|
||||
|
@@ -88,4 +88,26 @@ class type_string extends type_string_common implements type_interface
|
||||
{
|
||||
return 'VCHAR';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_language_options($field_data)
|
||||
{
|
||||
$options = array(
|
||||
'lang_name' => 'string',
|
||||
);
|
||||
|
||||
if ($field_data['lang_explain'])
|
||||
{
|
||||
$options['lang_explain'] = 'text';
|
||||
}
|
||||
|
||||
if (strlen($field_data['lang_default_value']))
|
||||
{
|
||||
$options['lang_default_value'] = 'string';
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
@@ -92,4 +92,26 @@ class type_text extends type_string_common implements type_interface
|
||||
{
|
||||
return 'MTEXT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_language_options($field_data)
|
||||
{
|
||||
$options = array(
|
||||
'lang_name' => 'string',
|
||||
);
|
||||
|
||||
if ($field_data['lang_explain'])
|
||||
{
|
||||
$options['lang_explain'] = 'text';
|
||||
}
|
||||
|
||||
if (strlen($field_data['lang_default_value']))
|
||||
{
|
||||
$options['lang_default_value'] = 'text';
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user