0

In my theme-settings.php i want to set text format to 'filtered_html' and display in page.tpl.php.

I used this code to display text area:

$form['options']['description'] = array(
'#type'          => 'textarea',
'#title'         => t('Description'),
'#default_value' => theme_get_setting('description'),
);

And display it using <?php print strip_tags(theme_get_setting('description')); ?> in page.tpl.php

How do i set the textarea to use 'filtered_html' format

1 Answer 1

0

Try this:

$form['options']['description'] = array(
'#type'          => 'text_format',
'#title'         => t('Description'),
'#default_value' => theme_get_setting('description'),
'#format'        => 'filtered_html',
);

https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7.x/#text_format

2
  • im getting error Notice: Array to string conversion in include() (line 199 of F:\DEV\SITES\DEV\1se\profiles\1se\themes\1se\templates\page.tpl.php).
    – user81244
    Commented Sep 30, 2016 at 6:55
  • You're probably running into the fact that the description is being saved inside of the options array. Maybe something like $options = theme_get_setting('options); print $options['description'];
    – lynbermt
    Commented Oct 7, 2016 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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