So according to a post in the forum, by uploading an existing pattern with changes should automatically update if the content already exists. I've created a content type with a pattern, if I change one of the attributes like
1 to
0, i would think it would just update the settings accordingly for the content type however when running the updated pattern, I get an error:

Action #1: CCK: Create or Edit Content Type (op "execute")
PHP error occured:
warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /home/mydirectory/public_html/mysite/sites/all/modules/patterns/patterns.module on line 2397.

The pattern itself looks like this (I've excluded the obvious info and xml declaration just to keep this short and sweet):

  <actions>
	<content>
		<name>Sample Tip</name>
		<type>sample_tips</type>
		<description></description>
		<status>1</status>
                <promote>0</promote>
		<title_label>Title</title_label>
		<body_label>Body</body_label>
		<comment>0</comment>
	</content>
  </actions>

So... can you not update an existing content type once its already been created? Is there a trick to this? I'm confused.
Thanks.

Comments

apmsooner’s picture

Okay so testing this out further, I can create new content types but I cannot figure out how to edit them with a pattern. Let's say I created a content type called "Custom Type" with machine name of custom_type. How do I write a pattern that will update the settings for that content type like changing the publishing status, or disabling comments, etc....??? Is this possible?

ChrisBryant’s picture

Updating a pattern as you are doing "should" just work, so it's possible you may have run into a bug. Check out this discussion with senpai and vaish about this:

http://drupal.org/node/346135

Also, check out this somewhat related but different issue with sarvab's comment about updating or overwriting pattern settings when dealing with select lists, radio buttons, dropdowns, etc: http://drupal.org/node/434870#comment-1486798

I'll test and see if I get the same error with the above pattern.

apmsooner’s picture

Thanks for the reply, I'm pretty sure we have a bug here. I've gone through and reviewed my code and it just seems to wanna fail everytime.

vaish’s picture

Status: Active » Fixed

This bug went unnoticed till now because I couldn't reproduce it on my machine. Thanks for the report. Fix committed.

apmsooner’s picture

Cool, latest dev version works for me now. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.