1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 17:56:52 +02:00

[ticket/11201] Move language option determination into type class

PHPBB3-11201
This commit is contained in:
Joas Schilling
2014-01-15 18:25:28 +01:00
parent bd1425d075
commit 78603bb96d
8 changed files with 126 additions and 26 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}