1

I've looked through different threads about this issue and didn't see any answers. I have a fresh install of Drupal 7 with no extra modules enabled. I've started building a custom theme but it doesn't list itself in the blocks section even though it's enabled. It shows the original bartik theme and the admin seven theme. The odd part is I added a new block under Header which I have listed in my .info page and it showed up in my theme but I can't edit the block because the it only gives access to those two themes and not mine. How can I fix this?

I also have all of these error messages in the admin and I've barely added anything to my theme. Not sure what I'm missing.

Notice: Undefined index: name in block_menu() (line 146 of /home/infanity/public_html/beta/modules/block/block.module).
Notice: Undefined index: name in block_menu() (line 165 of /home/infanity/public_html/beta/modules/block/block.module).
Notice: Undefined index: name in system_menu() (line 647 of /home/infanity/public_html/beta/modules/system/system.module).
Notice: Undefined index: name in _ctools_list_themes() (line 574 of /home/infanity/public_html/beta/sites/all/modules/ctools/includes/plugins.inc).
Notice: Undefined index: name in block_menu() (line 146 of /home/infanity/public_html/beta/modules/block/block.module).
Notice: Undefined index: name in block_menu() (line 165 of /home/infanity/public_html/beta/modules/block/block.module).
Notice: Undefined index: name in system_menu() (line 647 of /home/infanity/public_html/beta/modules/system/system.module).
Notice: Undefined index: name in _ctools_list_themes() (line 574 of /home/infanity/public_html/beta/sites/all/modules/ctools/includes/plugins.inc).
Notice: Undefined index: name in system_sort_modules_by_info_name() (line 944 of /home/infanity/public_html/beta/modules/system/system.admin.inc).
Notice: Undefined index: name in system_sort_modules_by_info_name() (line 944 of /home/infanity/public_html/beta/modules/system/system.admin.inc).
Warning: uasort() [function.uasort]: Array was modified by the user comparison function in system_themes_page() (line 139 of /home/infanity/public_html/beta/modules/system/system.admin.inc).
Notice: Undefined index: name in system_themes_page() (line 148 of /home/infanity/public_html/beta/modules/system/system.admin.inc).
Notice: Undefined index: name in system_themes_page() (line 190 of /home/infanity/public_html/beta/modules/system/system.admin.inc).
Notice: Undefined index: name in theme_system_themes_page() (line 2728 of /home/infanity/public_html/beta/modules/system/system.admin.inc).

I've stripped my theme to just the .info file which the manual says is all that's required and I still get errors and although enabled still doesn't show up as the default theme in the block section. Here is my .info file labled fod.info in a folder labeled fod in the sites/all/themes folder.

name = fod
core = 7.x

stylesheets[all][] = css/style.css
regions[header] = Header
regions[highlighted] = Highlighted
regions[help] = Help
regions[content] = Content
regions[navigation] = Navigation
regions[sidebar_first] = Left sidebar
regions[sidebar_second] = Right sidebar
regions[footer] = Footer

And here are the errors I'm still getting in the admin.

Notice: Undefined index: name in block_help() (line 69 of /home/infanity/public_html/betaD/modules/block/block.module).
Notice: Undefined index: name in block_menu() (line 146 of /home/infanity/public_html/betaD/modules/block/block.module).
Notice: Undefined index: name in block_menu() (line 165 of /home/infanity/public_html/betaD/modules/block/block.module).
Notice: Undefined index: name in system_menu() (line 647 of /home/infanity/public_html/betaD/modules/system/system.module).

3
  • Does your new theme have any regions?
    – BetaRide
    Jul 6, 2012 at 4:36
  • All I did was declare the header. I thought the rest were declared by default. Jul 6, 2012 at 11:53
  • Have you tried to recreate fod.info from the scratch? It misses the name written into fod.info. Check the encoding of the file too. Jun 10, 2013 at 19:43

4 Answers 4

3

If you want to skip the full story

Search for any "*.info" file in your drupal repo that has no line similar to "name = xxxx".

My problem was due to a file named "lcov.info" in a grunt module (grunt-svgmin) in my theme. I happended "name = lcov is not a theme" at the beginning of the file and the issue fade away. I'll check svg-min later.


Full story

I had the same notice problem for few days.

The notice was a pattern of 3 lines :

in block.module :

line 146 :

'title' => check_plain($theme->info['name'])

and line 165

'title' => check_plain($theme->info['name']),

in system.module line 647 :

'title' => $theme->info['name'],

This pattern is replicated a variying number of times depending on the pages.

I've tried switching theme in vain.

I first tried to cleanup - hence the last part may apply. It worked at first (which explains my first response), but came back.

*What I did : * Open system.module and go to line 645

  foreach (list_themes() as $theme) {
    $items['admin/appearance/settings/' . $theme->name] = array(
      'title' => $theme->info['name'],

insert these two var_dump lines :

 foreach (list_themes() as $theme) {
    var_dump("-----------------");
    var_dump($theme->info['name']);
    $items['admin/appearance/settings/' . $theme->name] = array(
      'title' => $theme->info['name'],

Visit your site. It should show something like

string '-----------------' (length=17)
string 'A Theme' (length=5)
string '-----------------' (length=17)
string 'Bartik' (length=6)
string '-----------------' (length=17)
string 'Garland' (length=7)
string '-----------------' (length=17)
null
string '-----------------' (length=17)
string 'Seven' (length=5)
string '-----------------' (length=17)
string 'Stark' (length=5)
string '-----------------' (length=17)
string 'Zen' (length=3)

See this empty line where it is written null ???? This is the F....g theme. So I looked up to the admin theme to find the culprit and got rid of "engines" folder ...But discovered engine is not a theme, so added it back. I then went

drush pm-list --type=Theme

And found a disabled theme named *lcov (lcov) *

Believe it or not : it is not a drupal theme !!

it is a file named lcov.info in a node module -- grunt-svgmin -- in my theme

*TADA !!! *


First attempt

The sub theme I heritated was based on ZEN, but zen was not inclued any longer. Also, theme name included numbers abc123

On a another instance of the local site I :

Added a fresh version of zen and activated it

ran drush zen "My human readable Theme name" mymachinethemename /* the latter will generate a clean version of your ZEN subtheme */

Adjusted the subtheme.info file for regions, assets and optins

Moved the badly named theme to another folder outside of the site

started adding back assets from the old theme, then templates and includes, piece by piece, renaming functions to match the theme name

No need to say you need to backup and work on a dedicated branch and database. You might have to reposition blocks in admin.

Not sure it was the most efficient but as I'm roughly new to drupal it was a great way for me to dig in this legacy theme.

Charles

0

Blocks are put into regions. The regions are defined in the *.info file of your theme an put into place in the page.tpl.php. Actualy I have never worked without this building blocks in plac,e but if the theme hasn't any regions, they cannot show up in the blocks configuration.

If you're new to drupal theming I sugest to take a base theme and create a subtheme to tweak it to your nedds. The zen theme is a good starting point and it commes with a ready built start-kit for subthemeing. Also have a look at drupal theming guide.

Hope this get's you going.

3
  • I've stripped my theme down to just the .info file and I still get errors. I put a copy of that file above. Doesn't make sense to me. Jul 6, 2012 at 14:43
  • You've got to declare all the regions you will support or none (will fallback to defaults). Also, the theme must be active in the /appearance page. Jul 6, 2012 at 15:47
  • Assuming you have written everything syntactically correct, you will have to clear cache everytime you edit info file
    – Minty
    Aug 7, 2012 at 0:09
0

The error you are getting is caused from the fact the name is missing from the .info file for your theme.
In block_menu(), the code that is causing the error is the following one.

$items['admin/structure/block/list/' . $key] = array(
  'title' => check_plain($theme->info['name']), 
  'page arguments' => array($key), 
  'type' => $key == $default_theme ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, 
  'weight' => $key == $default_theme ? -10 : 0, 
  'access callback' => '_block_themes_access', 
  'access arguments' => array($theme), 
  'file' => 'block.admin.inc',
);
$items['admin/structure/block/demo/' . $key] = array(
  'title' => check_plain($theme->info['name']), 
  'page callback' => 'block_admin_demo', 
  'page arguments' => array($key), 
  'type' => MENU_CALLBACK, 
  'access callback' => '_block_themes_access', 
  'access arguments' => array($theme), 
  'theme callback' => '_block_custom_theme', 
  'theme arguments' => array($key), 
  'file' => 'block.admin.inc',
);

In system_menu(), the code causing the error is the following one.

  foreach (list_themes() as $theme) {
    $items['admin/appearance/settings/' . $theme->name] = array(
      'title' => $theme->info['name'], 
      'page arguments' => array('system_theme_settings', $theme->name), 
      'type' => MENU_LOCAL_TASK, 
      'access callback' => '_system_themes_access', 
      'access arguments' => array($theme), 
      'file' => 'system.admin.inc',
    );
  }

In all the cases, the error is raised when Drupal tries to access $theme->info['name'], but the "name" index is not defined.

Be sure there isn't any strange Unicode character before name =, especially an invisible character.

If you are editing the .info file of the theme when the theme is enabled, you need to first disable it, and re-enable it, as the content of the .info file is cached.

-2

Try to save you themename.info file as ANSI code.

2
  • 1
    Not only do I fail to see how this is relevant, but I think it's downright wrong. Haven't we suffered enough issues due to the lack of UTF character handling?
    – Letharion
    Mar 3, 2013 at 10:33
  • yep, not relevant i'm afraid :) Jun 10, 2013 at 23:25

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.