我正在将 ExpressionEngine 用于包含产品的多语言网站。我使用Transcribe来控制多语言。产品在不同语言中具有相同的标题,这给我在关系字段中选择正确产品带来了一些问题。
本站建设者不仅title
在后台使用了唯一的名字,还在前台处处显示。
下拉示例:
- 产品A
- 产品A
- 产品A
- 产品B
- 产品B
- 产品B
- 产品c
- 产品c
- 产品c
我发现下拉信息是/system/expressionengine/fieldtypes/rel/ft.rel.php
从第59行填写的
/**
* Display Relationship Field
*
* @access public
* @param string
* @return string
*/
function display_field($data)
{
if ($this->settings['field_related_orderby'] == 'date')
{
$this->settings['field_related_orderby'] = 'entry_date';
}
$this->EE->db->select('entry_id, title');
$this->EE->db->where('channel_id', $this->settings['field_related_id']);
$this->EE->db->order_by($this->settings['field_related_orderby'], $this->settings['field_related_sort']);
if ($this->settings['field_related_max'] > 0)
{
$this->EE->db->limit($this->settings['field_related_max']);
}
$relquery = $this->EE->db->get('channel_titles');
if ($relquery->num_rows() == 0)
{
return $this->EE->lang->line('no_related_entries');
}
else
{
if ( ! isset($_POST[$this->field_name]))
{
$this->EE->db->select('rel_child_id');
$relentry = $this->EE->db->get_where('relationships', array('rel_id' => $data));
if ($relentry->num_rows() == 1)
{
$data = $relentry->row('rel_child_id') ;
}
}
$field_options[''] = '--';
foreach ($relquery->result_array() as $relrow)
{
$field_options[$relrow['entry_id']] = $relrow['title'];
}
return form_dropdown($this->field_name, $field_options, $data, 'id="field_id_'.$this->field_id.'"');
}
}
如何将语言名称添加到第 98 行的下拉列表中($field_options[$relrow['entry_id']] = $relrow['title'];)
?