You are here: Home → Forum Home → Free add-ons → Extensions → Thread
Hi Max, I am getting the following error using MX Multi Language Labels when I try to create a category:
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: cp/admin_content.ph
Line Number: 1935
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/****/codeigniter/system/core/Exceptions.php:170)
Filename: core/Common.php
Line Number: 405
The same error was in MX Title Control according to this post: http://expressionengine.com/forums/viewthread/165716/
I disabled this addon and checked, no error, enabled again, checked and the error was back so pretty sure it’s your addon.
Thanks
sorry for delay - just add it to todo list for this weekend.
Hey Max,
I think the MX Multi Language Labels extension doesn’t quite behave well with EE 2.2.2.
For some reason every custom field label has the value of the field name regardless if you check ‘Default Labels’ or not.
Anyway, I did some testing and I noticed that in your code, the query on line 115 retrieves field name rather than field label.
$this->EE->db->select('channel_fields.field_id AS id, channel_fields.field_name AS name')->from('channel_fields')->join('channels', 'channels.field_group = channel_fields.group_id')->where('channels.channel_id', $this->EE->security->xss_clean(element('channel_id', $get)));
If you change it to:
$this->EE->db->select('channel_fields.field_id AS id, channel_fields.field_label AS label')->from('channel_fields')->join('channels', 'channels.field_group = channel_fields.group_id')->where('channels.channel_id', $this->EE->security->xss_clean(element('channel_id', $get)));
And then change line 129 in the for loop from:
$field['name'] = $data[$lang . "_" . $field['id']];
To:
$field['label'] = $data[$lang . "_" . $field['id']];
Finally jQuery line on line 139:
$("#hold_field_"+f.id+" label:first span").html(" "+f.label);
I am not sure if something changed in EE or I just found a bug but the above code change fixes the issue.
Anyway, love your extensions and hope my info helps someone else.
Jacek
I need to check it, but it look like need just move next code to line 136 (inside if (!isset($data[$lang])) condition)
$this->EE->load->library('javascript');
$out .= '
$(function(){
$.each(' . $this->EE->javascript->generate_json($query) . ',function(i,f){
el = $("#hold_field_"+f.id+" label:first span img").clone();
$("#hold_field_"+f.id+" label:first span").html(" "+f.name);
$("#hold_field_"+f.id+" label:first span").prepend(el);
});
});' . "\r\n";
(I can’t test it before evening)
No rush.
I think it’s still the query that needs to be changed as when you loop through the query results it contains field_name rather than the label and that’s why it was displaying the custom field names in the label.
Anyway, give it a test when you get the chance.
version 2.1.1 ready
Works like a charm.
Thanks