1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-13 04:04:12 +02:00

[ticket/11201] Add a method to return the translated full name of the type

PHPBB3-11201
This commit is contained in:
Joas Schilling
2014-01-18 13:08:15 +01:00
parent df85364baa
commit 197e026699
10 changed files with 28 additions and 13 deletions

View File

@@ -322,7 +322,7 @@ class profilefields
// empty previously filled blockvars
foreach ($this->type_collection as $field_key => $field_type)
{
$this->template->destroy_block_vars($field_type->get_name());
$this->template->destroy_block_vars($field_type->get_name_short());
}
// Assign template variables

View File

@@ -44,12 +44,20 @@ abstract class type_base implements type_interface
$this->user = $user;
}
/**
* {@inheritDoc}
*/
public function get_name()
{
return $this->user->lang('FIELD_' . strtoupper($this->get_name_short()));
}
/**
* {@inheritDoc}
*/
public function get_service_name()
{
return 'profilefields.type.' . $this->get_name();
return 'profilefields.type.' . $this->get_name_short();
}
/**

View File

@@ -63,7 +63,7 @@ class type_bool extends type_base
/**
* {@inheritDoc}
*/
public function get_name()
public function get_name_short()
{
return 'bool';
}

View File

@@ -55,7 +55,7 @@ class type_date extends type_base
/**
* {@inheritDoc}
*/
public function get_name()
public function get_name_short()
{
return 'date';
}

View File

@@ -63,7 +63,7 @@ class type_dropdown extends type_base
/**
* {@inheritDoc}
*/
public function get_name()
public function get_name_short()
{
return 'dropdown';
}

View File

@@ -47,7 +47,7 @@ class type_int extends type_base
/**
* {@inheritDoc}
*/
public function get_name()
public function get_name_short()
{
return 'int';
}

View File

@@ -12,11 +12,18 @@ namespace phpbb\profilefields\type;
interface type_interface
{
/**
* Get the name of the type, used for error messages and template loops
* Get the translated name of the type
*
* @return string Translated name of the field type
*/
public function get_name();
/**
* Get the short name of the type, used for error messages and template loops
*
* @return string lowercase version of the fields type
*/
public function get_name();
public function get_name_short();
/**
* Get the name of service representing the type

View File

@@ -47,7 +47,7 @@ class type_string extends type_string_common
/**
* {@inheritDoc}
*/
public function get_name()
public function get_name_short()
{
return 'string';
}

View File

@@ -47,7 +47,7 @@ class type_text extends type_string_common
/**
* {@inheritDoc}
*/
public function get_name()
public function get_name_short()
{
return 'text';
}