I am having a requirement that, automating the contributed module configurations via hook_update. I have a text area, where i need to mention different URLs with one URL/line. For reference look into the image:

enter image description here

To achieve this I have to use variable_set(); function. I tried something like below but not able to get all the values displayed.

$test = array('abc/*','xyz/*','ijk/*');
variable_set('boost_testing', $test);

This code is setting only first row, it will not come to next row.

So please suggest something I can do by using <br> or \n so that i can display each values next row. Any help will be appreciated.


You should pass paths as a string instead of array:

$test = "abc/*\nxyz/*\nijk/*\n";
variable_set('boost_testing', $test);

Remember to use double quotes for the $test string.


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.