bbeer Posted December 17, 2014 Share Posted December 17, 2014 Hi all we like to to change the content of some fields inside a FieldtypeTextareas field per API for several pages. her an example for one page. // set language wire("user")->language = 1014;// read language$en = wire("languages")->get('en');// list all products form this template is okforeach(wire('pages')->find("template=product,sort=prod_calc_capacity,include=hidden") as $p){// for one productif((string)$p == "1798"){// read value from multifield, is ok$fe = $p->prod_features_multi->prod_rating_operating_voltage;// output value, is okecho "$fe<br />";// set new value, value not set and why? nok$p->setLanguageValue($en, 'prod_rating_operating_voltage', 'test');}} your help is much appreciated. Link to comment Share on other sites More sharing options...
adrian Posted December 17, 2014 Share Posted December 17, 2014 I am no multi language expert, but i think you need this: $p->prod_rating_operating_voltage->setLanguageValue($en, 'test'); Link to comment Share on other sites More sharing options...
bbeer Posted December 17, 2014 Author Share Posted December 17, 2014 Hi adrain nope that does not work. get an Fatal error: Call to a member function setLanguageValue() on a non-objec Link to comment Share on other sites More sharing options...
adrian Posted December 17, 2014 Share Posted December 17, 2014 (edited) Oh I see - you are using a textareas field - sorry, I read textarea, not the plural. What about: $p->prod_features_multi->prod_rating_operating_voltage->setLanguageValue($en, 'test'); BTW, I am sure it works fine, but why: if((string)$p == "1798"){ and not: if($p->id == 1798){ EDIT: Are you using the new multilanguage version of the textareas fieldtype? Also, maybe this question should be posted in the support thread for Profields - that way it will get Ryan's attention for sure. Edited December 17, 2014 by adrian Link to comment Share on other sites More sharing options...
bbeer Posted December 17, 2014 Author Share Posted December 17, 2014 no it does not work, same error. Your BTW has nothing directly to do with the problem, but we changed it. Link to comment Share on other sites More sharing options...
Soma Posted December 17, 2014 Share Posted December 17, 2014 The field is not an object but a string. Turn off output formatting. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now