I'm using theme-settings.php to store links to external pages (like Facebook, Twitter, etc.) and the links aren't storing correctly. In theme-settings.php, I have:

function mytheme_form_system_theme_settings_alter(&$form, $form_state) {
 $form['mytheme_facebook'] = array(
'#type'          => 'textfield',
'#title'         => t('Facebook Link'),
'#default_value' => theme_get_setting('mytheme_facebook'),
'#description'   => t("Appears in sidebar block."),

);

On my Theme Settings page, I enter https://www.facebook.com/ in the "Facebook Link" field. When I hit save, I see that only "www.facebook.com" has been saved in that field.

So, when I call the field on my site, using

print theme_get_setting('mytheme_facebook');

the link that gets outputted is http://www.myurl.org/www.facebook.com/.

How can I get I get rid of the "myurl" stuff, so I get a working link to Facebook? Oh, and I'm using Drupal 7, if that helps.

Thanks in advance for any tips!

Drupal is probably applying your default text format to your field.

Try adding a #format value to the array that matches one of your less strict input formats.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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