Skip to content

Instantly share code, notes, and snippets.

@danreb
Created October 5, 2012 05:51
Show Gist options
  • Save danreb/3838311 to your computer and use it in GitHub Desktop.
Save danreb/3838311 to your computer and use it in GitHub Desktop.
Drupal Theme Specific Settings
<?php
/*
* Usage
* Insert to specific code block, div or regions
*
*/
<?php if (theme_get_setting('footer_credits')): ?>
<span class="credits"><?php print t('Powered by: '); ?> <a href="http://github.com/danreb/abtik">Abtik Base Theme</a></span>
<?php endif; ?>
<?php
/**
* Implements hook_form_FORM_ID_alter().
* Example of adding settings in Drupal theme.
* This adds credits
*/
function THEMENAME_form_system_theme_settings_alter(&$form, $form_state) {
$form['THEMENAME_settings']['footer'] = array(
'#type' => 'fieldset',
'#title' => t('Footer'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['THEMENAME_settings']['footer']['footer_credits'] = array(
'#type' => 'checkbox',
'#title' => t('Show theme credits in footer'),
'#default_value' => theme_get_setting('footer_credits','abtik'),
'#description' => t("Check this option to show copyright text in footer. Uncheck to hide."),
);
return $form;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment