7 years ago
8
Topic

Hi

We are facing a new issue with the 1.30 code field : https://github.com/Octopoos/SEBLOD/issues/437

thanks

cyril

Get a VIP membership
7 years ago
0
Level 1

Hi

can somone confirm the issue please?

thanks

cyril

4229 Posts
Kadministrator
7 years ago
4
Level 2

Confirmed it does not work with curent versions, IDK if it worked previously. As workaround you can set fields default value to something like #xy# then replace this value in beforeRender like this 

	$fields['yourfield']->html = str_replace('#xy#', $yourvalue, $fields['yourfield']->html );
7 years ago
3
Level 3

Thanks, 

at last it is confirmed :) 

you wrote I should use the following syntax as a workaround: 

$fields['yourfield']->html = str_replace('#xy#', 'toto', $fields['yourfield']->html ); 

With this code doesn(t work in a multi language site: 

The field becomes visible again with the right link above it BUT the html is not replaced with 'toto' but COM_CCK_toto !! 

thanks 

cyril

4229 Posts
Kadministrator
7 years ago
2
Level 4

Translation of default value can be set in freetext parameters. Otherwise just add necessary keys to language overrides.

7 years ago
1
Level 5

Hello Klas

Sorry I don't understand what you are meaning. If we use code fields this is precisely to set dynamic values we can't prepare with the language overrides. The dynamic values is an HTML block with a lot of html tags.

Anyway I suspect the real solution is to wait for a fix to the code field.

thanks

cyril 

4229 Posts
Kadministrator
7 years ago
0
Level 6

COM_CCK_ comes from free field's translation of default value. If you don't want that you can turn it off in free field configuration. What happens is that in original html you get COM_CCK_#xy# and above replacement only replaces #xy# part.. If you refuse to turn off translations in free text field form religious or whatever reasons :) you can as well do $fields['yourfield']->html = str_replace('COM_CCK_#xy#', 'toto', $fields['yourfield']->html );  instead.

7 years ago
0
Level 1

Hi

thanks Klas, it's a good workaround, until the real fix comes :)

thanks again

cyril

Get a VIP membership