0

I am trying to subtheme Commerce Kickstart Admin Theme. I have copied all the folders and files to sites/all/themes/my__admin_subtheme, and changed the appropriate lines in my_admin_subtheme.info.

When I go to /admin/appearance, and change the section Administration theme to My Admin Theme, I get an error in template.php telling that the function commerce_kickstart_admin_preprocess_maintenance_page is declared twice.

How to solve this issue?

Edit:

When I change the name of preprocess function in template.php from commerce_kickstart_admin_preprocess_maintenance_page to my_admin_subtheme_preprocess_maintenance_page or delete template.php the fatal error disappear but I lose the formated html present in that function.

To make things more clear, the template.php is

<?php

/**
 * Override or insert variables into the maintenance page template.
 */
function livraria_acervo_admin_preprocess_maintenance_page(&$vars) {
  // While markup for normal pages is split into page.tpl.php and html.tpl.php,
  // the markup for the maintenance page is all in the single
  // maintenance-page.tpl.php template. So, to have what's done in
  // shiny_preprocess_html() also happen on the maintenance page, it has to be
  // called here.
  shiny_preprocess_html($vars);
  if (variable_get('install_task') != 'done') {
    $footer_markup =  '<div class="message">' . t('Proudly built by') . '</div>';
    $footer_markup .=  '<div class="logo">' . t('<a href="@url">Commerce Guys</a>', array('@url' => 'http://www.commerceguys.com')) . '</div>';
    $vars['footer'] = array(
      '#prefix' => '<div id="credit" class="clearfix">',
      '#markup' => $footer_markup,
      '#suffix' => '</div>',
    );
  }
}

I searched for that function in all file tree in root Drupal installation and didn't find any call for that function.

I see the function is related to the maintenance mode, the mode that I'm working now. Well, as I told above the fatal error disappeared but how to know where the function is called. I think the function is called somewhere and I would have to change the name in the file(s) that it's called, although I don't think this would the better way to solve the problem.

So some piece is missing in subtheming Commerce Kickstart 2 admin theme, and is related to the call of that function commerce_kickstart_admin_preprocess_maintenance_page.

I'm new to Drupal and have not practiced php very much, so I hope I have been cleared. If more information is needed please tell me. And sorry about my English too.

Thanks in advance!

1 Answer 1

1

PHP requires all function names to be unique*, you'll need to rename the functions in your sub-theme to my_admin_subtheme_FUNCTION_NAME, e.g. my_admin_subtheme__preprocess_page(&$vars).

You might want to consider clearing the template.php file completely and only copying the functions you need when you find you need them.

2
  • Thank you very much for reply @bloke_zero, I have tried your suggestion. The fatal error has gone, but the rendered html that is made by that preprocess function with the changed name to my_subtheme_FUNCTION_NAME doesn't work. I edited the question with the function and more information for a better analyses. Thanks again.
    – Caco
    Nov 10, 2014 at 14:38
  • There are 2 things I can think of, 1. Are you setting the base theme (drupal.org/node/225125) - you need something like base theme = theme_name in your .info file. 2. Have you cleared the cache? As the preprocess functions won't show up until you do.
    – bloke_zero
    Nov 11, 2014 at 10:00

Your Answer

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

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