<
Neerav Mehta
Founder & CEO
This page has the "Logo Image Settings" and "Shortcut Icon Settings".
You can also add your own fields to this form.
Drupal 7 provides a more easier and flexible way to add your custom settings in the theme settings.
You just need to create a "theme-settings.php" file in your theme folder and write a THEMENAME_form_system_theme_settings_alter(&$form, $form_state) function.
For example, let us add breadcrumb settings to the theme settings.
function MYTHEME_form_system_theme_settings_alter(&$form, $form_state) {
$form['breadcrumb'] = array(
'#type' => 'fieldset',
'#title' => t('Breadcrumb Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Breadcrumb elements
$form['breadcrumb']['breadcrumb_title'] = array(
'#type' => 'select',
'#title' => t('Breadcrumb title'),
'#description' => t('Do you want to show the title of the page in the breadcrumb?'),
'#options' => array(
0 => t('No'),
1 => t('Yes'),
),
'#default_value' => theme_get_setting('breadcrumb_title'),
);
}
Check http://api.drupal.org/api/drupal/7 for complete API reference
theme_get_setting('breadcrumb_title');
function MYTHEME_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
if (!empty($breadcrumb)) {
$output = '<'.OUTTAG.' class="element-invisible">' . t('You are here') . '<!--{cke_protected}{C}%3C!%2D%2D'.OUTTAG.'%2D%2D%3E-->';
if (theme_get_setting('breadcrumb_title') == 1) { // show the title setting
$breadcrumb[] = drupal_get_title();
}
$output .= '. implode(' » ', $breadcrumb);
return $output;
}
}
That is it and you are done!
Note: For setting the default value, you need the following code in your MYTHEME.info file
settings['breadcrumb_title'] = 1
Neerav Mehta
Neerav Mehta is the Founder & CEO of Red Crackle. With sterling qualities, Neerav’s technological acumen is firing a generation of progressive companies on the digital path. With an undergraduate degree in Electrical Engineering from India's most prestigious institution IIT Bombay and having spent seven years developing and contributing to the launch of AMD's innovative line of computer products, Neerav founded Red Crackle where he is lauded for his dynamic and innovative genius.
Let’s get you started!