0

I have a Field Collection item which consist of a drop down, a text box and a link field. After the user submits a form I create a node were this field collection item is included. Before I save it, I populate some fields.

I managed to set the 'Url' in the link field(part of field collection item) by using:

$field_collection_item2->field_url->setValue($base_url . '/form/email-project-completion-survey'); 

Which works fine. Now I'm trying to set the 'Link text' but I can't make it work.

Any idea?

Thank you in advance

0

I managed to solve it by using an array in setValue.

$field_collection_item2->field_url->setValue(array('uri'=>$base_url . '/form/email-project-completion-survey', 'title' => 'Survey'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.