diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2014-01-15 18:25:28 +0100 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2014-01-15 18:25:28 +0100 |
| commit | 78603bb96d0afa0695b296013dec17485d74ea45 (patch) | |
| tree | e0b34560bdd7618968b87621779ef0ace14093a2 /phpBB/phpbb | |
| parent | bd1425d07561345b7f92977f81bb1fb9e9cda927 (diff) | |
| download | forums-78603bb96d0afa0695b296013dec17485d74ea45.tar forums-78603bb96d0afa0695b296013dec17485d74ea45.tar.gz forums-78603bb96d0afa0695b296013dec17485d74ea45.tar.bz2 forums-78603bb96d0afa0695b296013dec17485d74ea45.tar.xz forums-78603bb96d0afa0695b296013dec17485d74ea45.zip | |
[ticket/11201] Move language option determination into type class
PHPBB3-11201
Diffstat (limited to 'phpBB/phpbb')
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_bool.php | 18 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_date.php | 17 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_dropdown.php | 18 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_int.php | 17 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_interface.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_string.php | 22 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_text.php | 22 |
7 files changed, 122 insertions, 0 deletions
diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index 6abac8c7bf..f4e0ac0f86 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -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; + } } diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index 1fcbf2ea3e..d2a10cdd15 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -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; + } } diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index e2b0dc646c..82c128861a 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -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; + } } diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php index 202005008f..a2e6f8e663 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -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; + } } diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index 917b95f653..f6f6355698 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -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); } diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index a9d9fddfb0..ee2eb8b760 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -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; + } } diff --git a/phpBB/phpbb/profilefields/type/type_text.php b/phpBB/phpbb/profilefields/type/type_text.php index 58cc2d2741..7aea982f6f 100644 --- a/phpBB/phpbb/profilefields/type/type_text.php +++ b/phpBB/phpbb/profilefields/type/type_text.php @@ -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; + } } |
