I get the subject line warning when I am importing XML via FEEDS XPATH parser. The XML input has date set right but after ingestion the date field defaults to current date. I checked and found that the default is set to NONE.

So there are 2 issues. One is why is date not getting parsed right and other why is it defaulting to current date.

can someone explain if the Theme key warning is causing these issues?

Location - http://nh-mnair-dt1/drupal/admin/structure/types/manage/eventful-feed-it...

Referrer - http://nh-mnair-dt1/drupal/admin/structure/types/manage/eventful-feed-it...

Comments

karens’s picture

Priority: Critical » Normal

Problems using xpath to import values are not critical bugs that make this module unusable.

colan’s picture

Title: Theme key "" not found. XPATH parser not parsing date. » Theme key "" not found

I think this is more generic than that. (Updating title.) I'm getting this message and not using xpath at all.

When clicking on "edit" to edit the field instance settings on the "Manage fields" tab of bundle, this error shows up:

Nov 16 14:27:23 hostname log-identity: http://site.example.com|1321471643|theme|192.168.1.1|http://site.example.com/admin/structure/types/manage/content-type/fields/field_date_example|http://site.example.com/admin/structure/types/manage/content-type/fields|2||Theme key "" not found.

What's strange is that it only happens if the widget type is not "Select list". If it's "Pop-up calendar" or "Text field", then you get the error when clicking on edit.

andypost’s picture

Same here for D7

Happens when editing date field

arlinsandbulte’s picture

Status: Active » Postponed (maintainer needs more info)

I cannot reproduce this error.

karens’s picture

I cannot reproduce this error either. Someone has to figure out how to replicate the error on a fresh install with just the Date module enabled. If you can't do that, it is probably related to some other module. But if we can't reproduce it there is nothing that can be done.

Daedalon’s picture

Status: Postponed (maintainer needs more info) » Active

Date Popup module seems to be the cause. When it's enabled in 7.x.2.0-rc1, I get the same in my error log after following the edit field link in content type:

Location [SITE]/admin/structure/types/manage/[CONTENT TYPE]/fields/field_[FIELDNAME]
Referrer [SITE]/admin/structure/types/manage/[CONTENT TYPE]/fields
Message Theme key "" not found.
Severity warning

I believe this has happened since alpha4 or earlier. With Date Popup disabled, this doesn't occur. The only other Date/Time modules enabled were Date and Date API. Changing admin theme between Garland, Stark and Seven didn't produce any changes.

karens’s picture

Status: Active » Closed (cannot reproduce)

Unless someone can tell me how I could reproduce this on a fresh install, nothing can be done (i.e. create a brand new site with just Date module, create a field, and look for the error). I can't reproduce it and I doubt anyone can reproduce it on a fresh install, plus lots of changes have been committed since it was reported so it may not even still be an issue. Theme key messages are not likely coming from here.

Macronomicus’s picture

for me, any node type that has a date field upon view or edit throws a wsod and I get the error.

http://mesite.com/admin/structure/types/manage/date/fields/field_date
Theme key "" not found.

In the end the only thing that worked for me.... without removing the actual date fields or my views, I fully uninstalled all date related modules and reinstalled and now the problem is gone, so I cant tell you how to reproduce it, but I can confirm the symptom may be more than just a one off from the OP.

seren10pity’s picture

I get exactly the same issue :

I've got a content type that is filled from an XML file via FEEDS XPATH parser.
In the XML file, i've got this tag <MY_TAG MY_DATE="30/04/2011" MY_TIME="01:30:00" />, and my field is an ISO date field whose date entry is in the custom format d/m/Y.
When importing data, the date saved is the current date, even if I check "No default value" in the settings.
I'm sure the xpath is correct because the time field has exactly the same configuration with "H:i:s" custom entry format, and it is saved correctly ; and the debug options give me the correct attribute too.
So, as the current date is registered, I guess the entry data is not given in the correct format. I've checked the logs, and I get this error :
Theme key "" not found. for htis field.

Hope it helps to reproduce the bug, and find a solution...
Thanks in advance ;)

karens’s picture

#9, your failure is probably because you have the date in the wrong format. Dates coming in from feeds need to be in the native format and timezone, i.e. YYYY-MM-DDTHH:MM:SS or a timestamp or whatever. If the date you import is nonsense to the date field, it will end up as the current date. The fact that you have created a custom format in the form element does not apply to a date imported from a feed, which does not use the form at all.

seren10pity’s picture

The fact that you have created a custom format in the form element does not apply to a date imported from a feed, which does not use the form at all

Thanks KarenS for your fast answer ! I understand better now.

It worked for time fields because the XML gives "01:35:00", what is the expected format for time, so it registered "2012-07-10T01:35:00" (given time with today's date).
It would have worked for date fields if the XML was giving the date in the format d-m-Y instead of d/m/Y.
But I can't change the input format of the XML date attributes. The file comes from a private software for management of events sales.
So I'll have to find a way to alter the data on import.

I just found this hook : hook_feeds_after_import(). I'll test it tomorrow and see if it works ;)

Thanks again !

seren10pity’s picture

Hi !
Here's my solution : hook_feeds_after_parse(FeedsSource $source, FeedsParserResult $result)

the object returned by $result looks loke this :

(Object) FeedsParserResult {
	title		=> '',
	description	=> '',
	link 		=> 'http://path_to_my_xml_file/file.xml',
	items 		=> Array(
				0 => Array(
					xpathparser:0	=> 'My item title'
					xpathparser:1	=> '00/00/00'
					xpathparser:2	=> '26/12/2012'
				),
				1 => Array([...]),	
	),
	current_item 	=> NULL
}

So, I've made a function to replace / by - in dates if the format corresponds :

function hook_feeds_after_parse(FeedsSource $source, FeedsParserResult $result) {	
	if(isset( $result->items[0] )){
		foreach($result->items as $k => $item){
			foreach($item as $j => $value){
				$result->items[$k][$j] = preg_replace('^([0-9]{2})/([0-9]{2})/([0-9]{2,4})^', '$1-$2-$3', $value);
			}
		}
	}
}

Maybe it's not very optimized (I'm open to suggestions) but for me, the date problem is solved ;)

jnettik’s picture

Status: Closed (cannot reproduce) » Active

Sorry to open this up again but I'm having the same problem and I'm not using any feeds on my site.

I have a product display for events (drupal commerce site) and I added a date field with a calendar popup widget. Whenever I try to edit the date settings I get a 500 internal server error (localhost using mamp) and none of my settings got saved.

One of the comments said that it may be related to the popup module. I disabled that and still the same problem. I checked watchdog and get this warning:

TYPE theme
DATE Friday, August 17, 2012 - 10:30
USER jnettik
LOCATION http://localhost/path/to/site/admin/structure/types/manage/product_event...
REFERRER http://localhost/path/to/site/admin/reports/event/4282
MESSAGE Theme key "" not found.
SEVERITY warning
HOSTNAME ::1
OPERATIONS

In checking my PHP log I show the following error. That's all I have for now. I'll still keep digging and see if I can find more to share.

[17-Aug-2012 10:22:30] PHP Fatal error: Call to undefined function date_field_widget_settings_form_validate() in /path/to/site/includes/form.inc on line 1389

jnettik’s picture

Status: Active » Closed (cannot reproduce)

Ah... Just found this issue that my problems were related the the Field Label Plurals module and the issue #1699312: Fatal error: Call to undefined function date_field_widget_settings_form_validate() in form.inc

n8handler’s picture

I had this problem today and was able to fix it by switching away from popup calendar and then back to popup calendar.

jphil’s picture

this is something wider than just the date module - I've experienced this 'out of the blue' whilst working on a completely different section of my site... will post solution

jphil’s picture

Status: Closed (cannot reproduce) » Active

Ha! very interesting... here's what I've found:

The theme key (referring to a .tpl.php) missing in my context was defined in a custom module (hook_theme obviously) that I had disabled and then re-enabled a couple of times. This was most likely the trigger in my setup.

Prior to that my theme call was working fine from within the page preprocessor function in template.php.

Once I made the possible connection, I moved the hook_theme from the module into template.php and it works again.

Either cache related, or perhaps something to do with the fact that my theme and the module in question had the same name. No time to dig deeper now ;)

So I doubt the Date module is the culprit here!

lsolesen’s picture

Status: Active » Closed (cannot reproduce)
lsolesen’s picture

sonicthoughts’s picture

having this issue with a page, not XML. recently upgraded from D6 to D7 ... still investigating.

trong.nguyen.tcec’s picture

Dear all,
Code error is at return array_key_exists($offset , $this->storage) when $offset is NULL.
Just change the code as below: on line number 414 to 422 file includes/theme.inc

public function offsetExists($offset) {
    // Since the theme registry allows for theme hooks to be requested that
    // are not registered, just check the existence of the key in the registry.
    // Use array_key_exists() here since a NULL value indicates that the theme
    // hook exists but has not yet been requested.
     

     return array_key_exists($offset."", $this->storage);
  }

I tested on Drupal 7.21.
I hope it helpful.