I am creating a variable in admin section that is of form type #type = text_format to get wysiwyg kind of editor. But having difficulty while displaying the field value in template file. I am trying to print like below in template file:

print_r(variable_get('web_pagetext', ''));

But in frontend its showing like below:

Array ( [value] => text, text..
[format] => full_html )

How I can remove Array([value], [format]) and only text to get displayed.


You should use check_markup for that:

$item = variable_get('web_pagetext', ['value' => '', 'format' => '']);
$formatted_text = check_markup($item['value'], $item['format');

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.